<h5>Пластиковое окно "Эконом"</h5> It is required that in quotes select in the span. I know that you can use regular expressions.
It is necessary to become so
<h5>Пластиковое окно "<span>Эконом</span>"</h5> It is required that in quotes select in the span. I know that you ...">
<h5>Пластиковое окно "Эконом"</h5> It is required that in quotes select in the span. I know that you can use regular expressions.
It is necessary to become so
<h5>Пластиковое окно "<span>Эконом</span>"</h5> var h5 = document.getElementsByTagName('h5')[0], str = h5.innerHTML, p1 = str.indexOf('"'), part1 = str.slice(0, p1), world = str.slice(p1+1, str.lastIndexOf('"')); h5.innerHTML = part1 + '"<span>' + world + '</span>"'; <h5>Пластиковое окно "Эконом"</h5> And a shorter solution:
var h5 = document.getElementsByTagName('h5')[0]; h5.innerHTML = h5.innerHTML.replace(/(.+)"(.+)"/, '$1"<span>$2</span>"'); console.log(h5.innerHTML); <h5>Пластиковое окно "Эконом"</h5> text.replace (/ Economy / g, "Economy"))
Source: https://ru.stackoverflow.com/questions/829998/
All Articles