jqueryとjavascriptを使用して、DOM(メモリ内のWebページ)内のすべての単語を置き換える必要があります。私はこれを変換する必要があります:
<html>
<head>
Hi to all
</head>
<body>
Hi to all
</body>
</html>
これに:
<html>
<head>
Bye to all
</head>
<body>
Bye to all
</body>
</html>
ただし、タグを変更せずに(そこにある値のみ)
1つの試みは次のとおりです。
jQuery.fn.replaceEachOne = function (objective, rep) {
return this.each( function(){
$(this).html( $(this).html().replace( new RegExp('(\\s'+objective+'\\s(?![[\\w\\s?&.\\/;#~%"=-]*>]))', "ig"), rep) );
}
);
}
しかし、それはタグ値を置き換え続け、私がそれを置くとページを壊します。
ヘルプ!!!