bootstrap-form表单
代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <!-- 自适配手机屏幕 initial-scale=1 支持缩放 --> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- 引入 css --> <link rel="stylesheet" type="text/css" href="/static/bootstrap3.4/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="/static/bootstrap-table/dist/bootstrap-table.min.css"> <!-- 引入 js jquery必须先引入 --> <script type="text/javascript" src="/static/jquery-3.2.1/jquery-3.2.1.js"></script> <script type="text/javascript" src="/static/bootstrap3.4/js/bootstrap.min.js"></script> <!-- 引入 bootstrap-table 2个 js --> <script type="text/javascript" src="/static/bootstrap-table/dist/bootstrap-table.min.js"></script> <script type="text/javascript" src="/static/bootstrap-table/dist/locale/bootstrap-table-zh-CN.min.js"></script> <title>Title</title> </head> <body> <div class="container"> <form action="/api/login" method="get"> <div class="form-group"> <label for="name">用户名</label> <input type = "text" id="name" name="name" class="form-control" placeholder="请输入用户名"> </div> <div class="form-group"> <label for="password">密码</label> <input type = "password" id="password" name="password" class="form-control" placeholder="请输入密码"> </div> <div class="form-group"> <button class="btn btn-info">提交</button> </div> </form> </div> </body> <script> $('input').keydown(function (event) { if (event.keyCode === 13) { return false; }}) </script> </html>