Button 锚定标签充当表单提交按钮?
锚定标签充当表单提交按钮Button 锚定标签充当表单提交按钮?,button,anchor,Button,Anchor,锚定标签充当表单提交按钮 <form method="get" action="<?php bloginfo('url'); ?>/"> <div class="field-search"> <input type="text" class="form-control input-lg" placeholder="Search for..." value="<?php the_search_query(); ?>"> &
<form method="get" action="<?php bloginfo('url'); ?>/">
<div class="field-search">
<input type="text" class="form-control input-lg" placeholder="Search for..." value="<?php the_search_query(); ?>">
<a href="#" class="btn-search"><i class="fa fa-search font-16"></i></a>
</div>
可能重复的
()
(这是一个复制的答案)试试这种方法,看看是否有效
将单击事件添加到锚定标记中,如下所示,然后执行一个事件。stopPropagation()
看看这是否有效你能详细说明一下吗?你有什么问题?你想干什么?你试过什么?你的尝试怎么没有成功?求你了,是吗?或者你是想问如何做到这一点?在这种情况下,你有没有尝试研究这个…?
<form action="test.aspx" type="POST">
<label>
<span>Username</span>
<input type="text" name="UserName" id="UserName" class="input-text required" />
</label>
<label>
<span>Password</span>
<input type="password" name="Password" id="Password" class="input-text required" />
</label>
<label>
<input type="checkbox" name="RememberMe" id="RememberMe" class="check-box" />
<span class="checkboxlabel">Remember Me</span>
</label>
<div class="spacer">
<a href="javascript:void(0)" class="login-button">Login</a>
</div>
</form>
$(document).ready(function(){
$(document).on("click",".login-button",function(){
var form = $(this).closest("form");
//console.log(form);
form.submit();
});
});
$('a').on('click', function(e){
e.stopPropagation();
})`