How can I parse a html document or just a html element in order to replace all specific strings into other ones ?
In other terms: - search for all strings #### in element .class - replace them with $$$$$
I'm using jQuery..
thanks
How can I parse a html document or just a html element in order to replace all specific strings into other ones ?
In other terms: - search for all strings #### in element .class - replace them with $$$$$
I'm using jQuery..
thanks
This is how you replace one class with another
$(".foo").addClass("bar").removeClass("foo")
or are you looking for a way to replace inside text nodes?
$("#something").find("*").andSelf().contents().each(function() {
if(this.nodeType == 3)
this.nodeValue = this.nodeValue.split(search).join(replace)
})
var str = $('.class').text();
str = str.replace(/####/g, '$$$$$');
$('.class').html(str);
Kind Regards
--Andy