Reputation: 2608
I want to the replace the html content of all instances of a class, with a regex :
$('ul#chosenmodel-menu').find("a.ui-link-inherit:contains(SMALL-WAVE)").each().html(function(idx,oldHtml){
return oldHtml.replace(/SMALL/, "blablablablabla");
});
but it doesn't work.
Upvotes: 0
Views: 28
Reputation: 82231
Try this:
$('ul#chosenmodel-menu').find("a.ui-link-inherit:contains(SMALL-WAVE)").each(function(){
$(this).html($(this).html().replace(/SMALL/, "blablablablabla"));
});
Upvotes: 0
Reputation: 67207
Try to remove that .each()
it wont need here,
$('ul#chosenmodel-menu').find("a.ui-link-inherit:contains(SMALL-WAVE)").html(function(idx,oldHtml){
return oldHtml.replace(/SMALL/, "blablablablabla");
});
Upvotes: 1