2

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!

Corey
  • 2,453
  • 4
  • 35
  • 63

2 Answers2

11

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" />

Fancyoung
  • 2,313
  • 26
  • 32
0

You can try this in CSS:

input[type='submit'] {
    background-image: url(images/icon.gif);
    background-position: 7px 7px;
    background-repeat: no-repeat;
}

Other Option is use button type="submit" instead of input

<button type="submit" class="btn btn-success">
    <i class='icon-right-circle'></i> Text
</button>
Jatin
  • 3,065
  • 6
  • 28
  • 42
  • That defeats the whole purpose of fontello. – Corey Jun 12 '14 at 22:28
  • This still doesn't answer my question. I'm aware of other methods of making the button work (your method, as well as making a simple anchor link and making it submit the form via JS). I'm asking if there is a way to put the icon in the value of an input. – Corey Jun 13 '14 at 01:02