I am having trouble changing the placeholder text using a function. I am unable to add any additional code to style the text, such as making it bold or adding an icon next to it. When I try to do so, the code is displayed as text instead of being executed. Here is the code snippet I am using:
$('#email').attr('placeholder', '<i class="fa fa-times" aria-hidden="true"></i> Invalid email.')
Instead of displaying the icon and text styled as intended, it shows the code itself:
"<i class="fa fa-times" aria-hidden="true"></i> Invalid email"
.
I have also attempted to use CSS and HTML functions to style the placeholder text, but they do not work. The only function that successfully changes the placeholder text for me is the attr method.