Sorry for my english =)
I need to replace some of the elements on a page. Here is my code:
var text1 = $('body').html().replace(/text1/, 'text11');
var text2 = $('body').html().replace(/text2/, 'text22');
var text3 = $('body').html().replace(/text3/, 'text33');
array = [text1, text2, text3];
for (var i = 0; i < array.length; i++) {
$('body').html(array[i])
};
But to replace only the first and third, if you remove the third element array, first and second is changed. Please tell me how to do it. Thank you!
1 Answer