0

How to replace string to node

I want to replace string to node. paragraph = document.getElementById('paragraph ') word = document.getElementById('word') val = paragraph.childNodes[0].nodeValue paragraph.innerHTML = val.replace(/text\s/, word) something like this.

10th Aug 2017, 3:43 PM
Илья баданин
Илья баданин - avatar
1 Resposta
0
Если правильно понял то это как то вроде так: paragraph.innerHTML = ''; paragraph.append(word);
7th Oct 2017, 2:25 PM
Siroj Samadov
Siroj Samadov - avatar