0

I would like display a font awesome icon as the submit input value. I tried the following code as per this SO question Font-awesome, input type 'submit'

Demo http://jsfiddle.net/sw87W/1077/

$(document).ready(function() {
  $('.btn-primary').val('');
});

I do not have any control over the html that is generated, therefore I can not change the input to a button

steve
  • 471
  • 6
  • 15
  • 2
    Possible duplicate of [Replace submit button value with ASCII character](https://stackoverflow.com/questions/33880304/replace-submit-button-value-with-ascii-character) – CBroe Jan 18 '18 at 15:12

1 Answers1

3

You can just use the Unicode escape sequence instead:

$('.btn-primary').val('\uf0c7');
CBroe
  • 91,630
  • 14
  • 92
  • 150
  • @DarrenSweeney right, thanks. Didn’t check the result carefully enough when modifying OP’s fiddle, overlooked the `;` that showed up on the button after the icon ... – CBroe Jan 18 '18 at 15:14