html的表单提交没反应

  •  这里表单提交就有反应
 <form action="/dlindex" method="post">
        <a th:text="${zccg}"></a>
        <div class="form-group">
            <input type="text" class="form-control" name="name" id="exampleInputEmail1" placeholder="输入您的账号" style='width:350px;'>
            <small id="emailHelp1" class="form-text text-muted"></small>
        </div>
        <a th:text="${id}" th:href="@{/index_two}"></a>
        <div class="form-group">
            <input type="password"  class="form-control" name="password" id="exampleInputPassword1" placeholder="请输入您密码" style='width:350px;'>
        </div>
        <a th:text="${password}"></a>
        <div class="form-group">
            <button type="submit" class="btn btn-primary" >登录</button>
        </div>
    </form>

 

  • 这里同样的就没反应
  • 换成
    <input type="submit" value="提交"> 就能提交了

不知道什么原因,我是个初学者,希望大家帮我解答一下

因为input是表单组件,当type为submit时,可以提交表单

如果想用button按钮,可以加个click事件,在事件中提交数据

type = "button" 只是一个按钮,没有任何功能

type = "submit" 可以提交表单