I want to click on below link instead of the traditional way:
E.g
<a href="">Click Here</a>
instead of :
<input type="submit" value="Click Here"/>
Thanks in advance
I want to click on below link instead of the traditional way:
E.g
<a href="">Click Here</a>
instead of :
<input type="submit" value="Click Here"/>
Thanks in advance
Use
onclick="document.forms[0].submit()"
This will submit the first form in the document.
Or, if the form has name
property, you can use
onclick="document.form_name.submit()"
<a href="javascript:document.getElementById('yourForm').submit();">Click Here</a>
And your form should have an id
:
<form id="yourForm" ...>
Okay, first of all, if you have to use an a tag for submitting.
I suggest you to use jquery.
<script type="text/javascript">
$(document).ready(function(){
$('form > a.submitter').click(function(){
$(this).parent().submit();
return false;
});
});
</script>
But i strongly suggest you to use a button tag for submitting forms. Because buttons are easy to style.
just use:
<button type="submit">Submit</button>
Something like
<a href="#" style="color:#000000;text-decoration:none;" onclick="this.form.submit();">Submit</a>
Are you using image, or something like that in the <a>
element?