Anchor tag acts as a form submit button? -
anchor tag acts form submit button?
<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>
<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>
jquery
$(document).ready(function(){ $(document).on("click",".login-button",function(){ var form = $(this).closest("form"); //console.log(form); form.submit(); }); });
possible duplicate of (anchor tag submit button?)
(this copied answer)
Comments
Post a Comment