1

I have a function that changing placeholder text. However, I cant add a code to this. For example, if I want to do a bold or just add a icon near the text - it doesn't works and just displaying the code instead of doing it. This is the code:

$('#email').attr('placeholder', '<i class="fa fa-times" aria-hidden="true"></i> Invaild email.')

It just displaying it like that: "<i class="fa fa-times" aria-hidden="true"></i> Invaild email". I also tried to use css & html function - but It doesn't work. The only function that works to me to change the placeholder is the attr.

Web O
  • 103
  • 2
  • 9
  • http://stackoverflow.com/questions/19350291/use-font-awesome-icon-in-placeholder – Gawlas Dec 26 '16 at 12:21
  • use like [this](http://jsfiddle.net/ADjTF/220/) and find comments in this fiddle's html how to use? – Curiousdev Dec 26 '16 at 12:25
  • Thats cool @Curiousdev but Im trying to do that after I clicked submit, to change the icon too and displaying a message in the place holder. Is it possible? – Web O Dec 26 '16 at 12:27
  • yes, that's possible paste your submit click code here and button's html – Curiousdev Dec 26 '16 at 12:29
  • I added my php code and my html, is it ok? @Curiousdev – Web O Dec 26 '16 at 12:37
  • js code* not a php – Web O Dec 26 '16 at 12:37
  • Again, my goal is to add a icon to place holder in addition to the text, after they submit the form – Web O Dec 26 '16 at 12:38
  • If your goal is just to change the display after submit has been added, you might be able to get by with just using layered html elements to render the icon. You could increase the indent in the input to make room for the icon and render the icon as a separate element that displays at a higher z-index – Bryant Makes Programs Dec 26 '16 at 16:00

1 Answers1

0

If your goal is just to change the display after submit has been added, you might be able to get by with just using layered html elements to render the icon. You could increase the indent in the input to make room for the icon and render the icon as a separate element that displays at a higher z-index. There are plenty of tutorials for inputs with icons in this method.

Bryant Makes Programs
  • 1,493
  • 2
  • 17
  • 39