jeudi 24 août 2017

Remove specific html entity character from all labels text using jquery

I have the warning sign character which has the value of ⚠ in HTML Entity (decimal) and I'm trying to remove it from all checkboxes' label text.

For example, in HTML, one of my input tags is as follows:

<input id='input1'/><label for='input1'>This is the warning sign &#9888;</label>

How can I, using the $ (JQuery) selector, remove the &#9888; html entity from those labels.

Here's my attempt :

$('input:checkbox').each(function(index){       
    $(this).next().text().split('&#9888;').join(''); // I thought by splitting that part and then joining it with an empty string would work.
}); 




Aucun commentaire:

Enregistrer un commentaire