How to change placeholder with Font-Awesome content using jQuery?

Viewed 1601

I want to change the placeholder attribute trying attr() using it this way:

$(this).attr("placeholder", " Mandatory field");

But the result is not the Font-Awesome icon , it literally looks looks like this:

" Mandatory field"

Nevertheless, if I put

<input type="text" class="mandatory_field form-control" id="affiliation" placeholder="&#xf0a4; Mandatory field"/>

with CSS

.mandatory_field {  
   font-family: FontAwesome,"Helvetica Neue",Helvetica,Arial,sans-serif; 
}

It works, but I need to know how to get those results dynamically with jQuery.

Thanks in advance.

2 Answers
Related