Removing the symbol * from the label using jquery
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<label>Welcome text*</label> <label>Welcome text2*</label> <label>Welcome text3</label> <label>Welcome text4</label> $( "label" ).each(function() { var label_text_content=$(this).html(); var Lengthoftext = label_text_content.length; var last_char= label_text_content.charAt(Lengthoftext - 1); if(last_char=="*") { var label_text_without_specialchar = label_text_content.substring(0, label_text_content.length-1); $(this).html(label_text_without_specialchar); } }); |