var gethtml = $("#topmenu > li.l89 a").text().split(' ')[1].replaceWith('Any World');
The text is not changing even after using replaceWith
as shown above.
var gethtml = $("#topmenu > li.l89 a").text().split(' ')[1].replaceWith('Any World');
The text is not changing even after using replaceWith
as shown above.
After you call .text() you are no longer working with a jQuery object, but with a plain string. You can do it like this...
var text = $("#topmenu > li.l89 a").text()
, textParts = text.split(' ');
textParts[1] = "Any world";
console.log('New text', textParts.join(" "));
I wrote the long version for you to see the steps. If you want you can do it on a single line, but it is not very readable anymore.