I have the following HTML code:
<p>
<label>* Name</label>
</p>
<p>
<label>* Last Name</label>
</p>
<p>
<label>Mascot Name</label>
</p>
Is it possible to change the color only to the character *
with jQuery?
I tried with the function find()
but I repeat all the characters on the label.
If you insist on a scripted solution:
$("p > label:contains('*')").each(function () {
$(this).html($(this).html().replace("*", "<span class='red'>*</span>"));
});
Demo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With