Hi I am trying to get "a" tag as a submit button. I found a code somewhere in the web. But it didn't work.
<a href="#" onclick="this.form.submit()">Submit</a>
Is there any code for to achieve my need?
Hi I am trying to get "a" tag as a submit button. I found a code somewhere in the web. But it didn't work.
<a href="#" onclick="this.form.submit()">Submit</a>
Is there any code for to achieve my need?
Supposing the form is the direct parent you can do:
If not you can access through the forms name attribute like this:
See both examples here: http://jsfiddle.net/WEZDC/1/
Try this code:
But users with disabled JavaScript won't be able to submit the form, so you could add the following code:
Try something like below
Give the
form
anid
, and then:document.getElementById("yourFormId").submit();
Best practice would probably be to give your link an
id
too, and get rid of the event handler:in my opinion the easiest way would be somthing like this:
within the "link.php" you can request the value like this: