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

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -