Replace text in a tag using javascript? -
how may target links in list items using javascript remove characters? example have following code:
<dd class="xments"> <ul> <li><a href="#">"blah blah",</a></li> <li><a href="#">"lo lo",</a></li> <li><a href="#">"hhe he"</a></li> </ul> </dd>
i wish remove " , , each list item. please 1 help?
$("a").text(function(_, text) { return text.replace('"', ''); return text.replace(',', ''); });
doesn't seem me. how target items in list , not tags in doc?
$('a').each(function (i, e) { $(e).text($(e).text().replace(/[",]/g, '')) });
yours regexp (and additional conditions):
$("dd.xments ul li a").text(function(idx, text) { return text.replace(/[",]/g, ''); });
Comments
Post a Comment