Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can add an &lt;a/&gt; with the icon somewhere, and bind a JavaScrit action to it, that submits the form. If necessary, the name and value of the original submit button's name+value can be there in a hidden attribute. It's easy with jQuery, please allow me to avoid the pure JavaScript version.</p> <p>Suppose that this is the original form:</p> <pre class="lang-html prettyprint-override"><code>&lt;form method="post" id="myFavoriteForm&gt; ...other fields... &lt;input class="btn btn-primary" type="submit" name="login" value="Let me in" /&gt; &lt;/form&gt; </code></pre> <p>Change it like this:</p> <pre class="lang-html prettyprint-override"><code>&lt;form method="post" id="myFavoriteForm"&gt; ...other fields... &lt;a href="#" class="btn btn-primary" id="myFavoriteFormSubmitButton"&gt; &lt;i class="icon-user icon-white"&gt;&lt;/i&gt;&amp;nbsp;Let me in &lt;/a&gt; &lt;/form&gt; </code></pre> <p>...and then the magical jQuery:</p> <pre class="lang-js prettyprint-override"><code>$("#myFavoriteFormSubmitButton").bind('click', function(event) { $("#myFavoriteForm").submit(); }); </code></pre> <p>Or if you want to make sure that the user can always submit the form --that's what I would do in your shoes--, you can leave the normal submit button in the form, and hide it with jQuery .hide(). It ensures that login still works without JavaScript and jQuery according to the normal submit button (there are people using links, w3m and similar browsers), but provides a fancy button with icon if possible.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload