Search code examples
htmlfontello

How to put fontello icon in input value?


Say I have this code:

<input type="submit" value="Send" />

But after the text "Send" I want to have a fontello icon. Obviously this doesn't work:

<input type="submit" value="Send <i class='icon-right-circle'></i>" />

In my fontello demo.html file, the code for that icon is 0xe81c. Isn't there a away to put this icon in the input value? Like as an HTML entity or something?

Thanks!


Solution

  • This should work:

    <input type="submit" value="Send &#xf001;" style="font-family:icons" />

    There are two steps:

    1. use &#xf001; to output character. You can find code in fontello css file, someting like content:'\f001', just do the replace \f001 -> &#xf001;.

    2. set font-family for this element. I use icons in my code, you should check the font name in css file.


    Further step: You can customize your own class:
    .myfont { font-family:icons; }

    and the html will be:
    <input type="submit" value="Send &#xf001;" class="myfont" />