为什么表单上的提交按钮不起作用?
Why submit button on the form is not working?
我已经下载了一个示例表单,它是这样的:
<form id="login-user" method="post" accept-charset="utf-8" action="/home.html" class="simform">
<div class="sminputs">
<div class="input full">
<label class="string optional" for="user-name">Email*</label>
<input class="string optional" maxlength="255" id="user-email" placeholder="Email" type="email" size="50" />
</div>
</div>
<div class="sminputs">
<div class="input full">
<label class="string optional" for="user-pw">Password *</label>
<input class="string optional" maxlength="255" id="user-pw" placeholder="Password" type="password" size="50" />
<span class="hide-password">Show</span>
</div>
</div>
<div class="simform__actions">
<input class="sumbit" name="commit" type="sumbit" value = "Log in"/>
<span class="simform__actions-sidetext"><a class="special" role="link" href="#">Forgot your password?<br>Click here</a></span>
</div>
</form>
当我按下提交按钮时,它不工作,它会点击按钮旁边的文本!但是当我改变这一行
<input class="sumbit" name="commit" type="sumbit" value = "Log in"/>
<button class="sumbit" name="commit" type="sumbit" value = "Log in"/>
它是工作,但我的css设计将改变。
我的另一个问题是,我想知道CSS文件是否会对html页面的功能产生影响。我认为它只影响设计和形式。是否如上所述对功能有影响?
编辑
这是我的javascript
$("#login-user").submit(function(event){
event.preventDefault();
alert("Here");
var name = $("#user-email").val();
var pass = $("#user-pw").val();
Parse.User.logIn(name,pass,{
success: function(user){
checkLogin();
alert("Thanks for login");
window.location.href = "/home.html";
}, error : function(user, error){
console.log("Login Error : " + error.message);
}
});
我认为这是正确的。
<button class="sumbit" name="commit" type="submit" value = "">
Log in
</button>
你的type="sumbit"
是错误的
我认为,你应该这样做。
<button class="sumbit" name="commit" type="sumbit" value = "Log in"/>
<button class="sumbit" name="commit" type="sumbit">Log in</button>
参考资料http://www.w3schools.com/tags/tag_button.asp
相关文章:
- JS动态添加字段-删除按钮不起作用
- 一键启动按钮不起作用
- 带有向下钻取的 Amchart 图表工作正常,但“后退”按钮不起作用
- 为什么不'这个HTML按钮不起作用
- 使用javascript后,提交按钮不起作用
- 镀铬延长件内部的聚合物纸按钮不起作用
- 我的提交按钮不起作用
- AngularJs:多次点击同一个按钮不起作用
- Ruby on Rails - 引导旋转木马按钮不起作用
- 为什么我的开关按钮不起作用
- 无法弄清楚为什么提交按钮不起作用
- 使用动画时Jquery后退按钮不起作用
- 禁用浏览器中的后退按钮不起作用
- 打印按钮不起作用
- jQuery-关闭按钮不起作用
- HTML按钮不起作用
- 清除Javascript/HTML中的画布按钮不起作用
- '有角度的靠背'返回页首按钮不起作用
- onclick() jQuery/JavaScript 显示饼图的按钮不起作用
- 网页Jquery下拉按钮不起作用