html - jQuery submit does not work but submit button does -
i've simple form want submit when click on tag. created jquery this:
jquery(function(){ jquery( "#ci-submit-location-form" ).click(function() { jquery( "#ci-location-search" ).submit(); }); });
for reasons don't see page after submit set in forms action field. seems page "realoading". jquery fired console.log when put in click().
however, simple submit field fires form correctly , desired page.
what have overlooked?!
here's dom of form:
<form action="restaurant-list.php" id="ci-location-search" method="get"> <input type="text" class="ci-location-input" placeholder="straße" /> <a href="" id="ci-submit-location-form" class="ci-submit-location-form" />send</a> <input type="submit" value="submit" /><!-- testing purpose --> <div class="ci-clear"></div> </form>
you need dom submit:
jquery( "#ci-submit-location-form" ).click(function(e){ e.preventdefault(); jquery( "#ci-location-search" )[0].submit(); });
finally think overlooked:
/>send</a>
check inline closing.
Comments
Post a Comment