when using an anchor and jquery to submit a form
<a id="submit_registration_form" href="#validate_form" >Submit</a> ....
$('#submit_registration_form').click(function() {
$('#registration_form').submit();
});
I can’t come back to the previous page (where the data were submit) if i use
<a href="javascript:window.history.back();">Edit form</a>
In order for the history.back() to work, form must be submitted using a submit button
<input type="submit" value="Submit" />
the probleme with input type submit button is that it is hard to style and get the same look as when using an anchor
Any help?
You would have to remember to
return falsein the handler function to stop the link getting followed after click.But it is much better to work on styling the submit button instead of abusing links, with the usability problems that brings. Some tips:
border: none,padding: 0,background: transparent,display: inline, and for Firefox,...::-moz-focus-inner { padding: 0; }.history.back()is also almost always the wrong thing (consider instead re-echoing the form contents in the new page), andjavascript:URLs are to be avoided in all cases.