Код: Выделить всё
function process(sentence,element) {
const words = sentence.split(' ');
const container = document.getElementById(element);
let index = 0;
container.innerHTML = '';
for (let i = 0; i < words.length; i++) {
//console.log(words[i]);
container.innerHTML += words[i] + ' '; // Display the word
}
}
process("the quick fox[/b] jumps",'e1'); //displayed the word 'fox' as expected in bold[b]process("the quick fox [/b] jumps",'e2'); //displayed the word 'fox' as plain text, not as expectedКод: Выделить всё
div{
border:1px solid #999;
margin: 0 0 10px 0;
display:block;
font-size:22px
}Код: Выделить всё
Подробнее здесь: https://stackoverflow.com/questions/793 ... dded-by-js
Мобильная версия