Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
38
rated 0 times [  44] [ 6]  / answers: 1 / hits: 22560  / 13 Years ago, sun, may 22, 2011, 12:00:00

i want a anchor should act like and input type submit button.
i am using a jquery plugin library that actually uses input type submit but i have styled my buttons on anchors. i dont want to use



<input type=button>


or



<input type=submit>


i want to use anchors such as



<a href=javascript to submit the form ></a>


and here is my jquery code where i want to use



 {
var submit = $('<button type=submit />');
submit.html(settings.submit);
}
$(this).append(submit);
}
if (settings.cancel) {
/* if given html string use that */
if (settings.cancel.match(/>$/)) {
var cancel = $(settings.cancel);
/* otherwise use button with given string as text */
} else {
var cancel = $('<button type=cancel />');


how to use anchors instead of button.


More From » html

 Answers
3

If you want an anchor tag to act like a button just do this



<!--YOUR FORM-->
<form id=submit_this>.....</form>
<a id=fakeanchor href=#></a>

<script>
$(a#fakeanchor).click(function()
{
$(#submit_this).submit();
return false;
});
</script>

[#92124] Thursday, May 19, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cruzs

Total Points: 710
Total Questions: 113
Total Answers: 100

Location: Nepal
Member since Sat, Jul 18, 2020
4 Years ago
cruzs questions
Thu, Nov 26, 20, 00:00, 4 Years ago
Wed, Oct 28, 20, 00:00, 4 Years ago
Wed, Aug 19, 20, 00:00, 4 Years ago
Sun, Aug 2, 20, 00:00, 4 Years ago
;