Paul Collins schrieb:
Hi all,
I am trying to use an anchor link to submit my form using the
Validator plugin, (so I can change the button to a graphic). I would
like to know what to put into the HREF to submit to the Validator
code.
Currently I have:
href="javascript:$(this).validate();"
This doesn't seem to work correctly, here is my full block of code in
case you would like to check. I would greatly appreciate any help or
links.
$(document).ready(function(){
$(":submit[id$='_replace']").each(function() {
var submitID = $(this).attr("id");
var submitValue = $(this).attr("value");
$(this).replaceWith( [ '<a class="replace '
, submitID
, '" id="'
, submitID
, '"
href="javascript:$(this).validate();"><em></em>'
, submitValue
, '</a>'
].join('') );
});
return false;
});
Thanks again
Try this:
<a href="#" id="clicksubmit">Submit</a>
$(function() {
$("#clicksubmit").click(function() {
$("form").submit();
return false;
});
});
There is no need to put javascript inside hrefs when using jQuery.
Jörn