How to replace the submit button with a link without using javascript ? is there any way to add the submit attribute to a link ? because the form will not be sent by a simple li
Try this:
CSS
button {
background:none!important;
border:none;
padding:0!important;
/*border is optional*/
border-bottom:1px solid #444;
}
HTML
<button>your button that looks like a link</button>
This can achieve the same effort and it looks like <a>
Note: btn
btn-link
comes from bootstrap
<button class="btn btn-link" type="submit"><img src="icon.png" /></button>
You can not submit a form using an <a>
tag alone. You will need some type of javascript to assist, if you insist on using the <a>
tag:
<a href="#" onclick="$(this).closest('form').submit()">Submit the Form</a>
or
<a href="#" onclick="document.getElementById('form-id').submit()">Submit the Form</a>
or super hack:
<a href="backendPage.php?param1=yes¶m2=no">Submit the Form</a>
, then on backendPage.php you can use $_GET
requests to process information, and redirect the visitor to the intended page. But that's a horrible idea haha
There is an another way out. Using this method you can use any element to submit a form. Following is an example:
<span onclick="$('#submit').trigger('click')" style="cursor:pointer;">
anything
</span>
Add a hidden submit button:
<input style="display:none;" type="submit" id="submit"/>
This will behave exactly as actual submit button.