Reputation: 22519
I want to create a submit link instead of a submit button.
It looks like any ordinary link (blue and underlined) and when you click on it, the form is submitted.
Edit: is it possible to do this without javascript/jquery?
Upvotes: 4
Views: 13268
Reputation: 7211
You can achieve this simply by using jquery!
Just do the following code ---
$('.your-sumbmit-link').click(function (e) {
e.preventDefault();
$('.your-form').submit();
});
Hope this helps!
Upvotes: -1
Reputation: 3848
No js, only CSS
<input type="submit" value="ABC" style="background:none; border-width:0px; color:blue; text-decoration:underline;" />
Upvotes: 5
Reputation: 61737
You can do it with Javascript:
<a href="#" onclick="document.formName.submit();return false;">submit form</a>
Edit:
This page:
http://www.beginningjavascript.com/Chapter4/exampleSubmitToLinks.html
has styled a button to look like a link, but it still uses Javascript to achieve it.
Upvotes: 3
Reputation: 15867
Sure!
HTML:
<form>
<input type="text" placeholder="name" />
<button type="submit">Submit</button>
</form>
CSS:
button {
background: none;
border: none;
color: blue; text-decoration: underline;
cursor: pointer;
}
Example here: http://fiddle.jshell.net/Shaz/AQDcD/1/
Upvotes: 1
Reputation: 3408
You can style the button to look like a link. i.e.
<input type="submit" value="submit" style="cursor: pointer; background-color: transparent; text-decoration: underline; border: 0; color: blue;" />
I'd do it with a stylesheet, rather than the inline styles, but you get the picture.
Upvotes: 0
Reputation:
jQuery can do this easily enough:
See: http://api.jquery.com/submit/
$('.submit-link').click(function(){
$('#form-id').submit();
});
Upvotes: 0