Сообщение от StartGames
|
Есть ли решение для jquery?
|
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(function() {
$('div').contents().filter(function() {
return this.nodeType == 3;
}).each((i, e) => {
let txt = ' abracadabra ';
e.nodeValue = e.nodeValue.replace(/(ID44).*?(\1)/g, `$1${txt}$2`);
})
});
</script>
</head>
<body>
<div>ID55 Здесь 1я часть текста ID55ID44 Здесь 2я часть текста ID44ID77 Здесь 3я часть текста ID77
</div>
</body>
</html>