Код: Выделить всё
/* any 'p' that immediately follows 'div' will be red */
div + p { color: red; }
foo
bar
baz
foo
bar
baz
< /code>
Но как сделать это в JavaScript? Я попробовал ближайший Код: Выделить всё
foo
foo
'use strict';
window.onload = function() {
for (const input of document.querySelectorAll('.input')) {
document.querySelector(input.closest('body > .output')).innerHTML = 'input.innerHTML';
}
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... ic-element
Мобильная версия