a标签提交form表单
如果美工给的form表单提交使用了a标签,这样就无法获取表单数据:
<form method="post">
<input name="username" >
<input type="password" name="password" >
<a href="index.html" >登录</a>
</form>
这是需要添加事件做表单提交:
- 给form表单加action和id:
<form action="/login" method="post" id="formId">
- a标签中添加onclick事件():
<a onclick="document:formId.submit()" >登录</a>