$('#rooms label:last-child').on('click', function() {
$('#rooms label:not(:last-child)').css('background', 'green');
});
<form>
<input type="text" id="input">
</form>
<p id="demo"></p>
input.addEventListener('input', function () {
if (this.value.length > 140) {
demo.textContent = 'Ваш текст';
} else {
demo.textContent = '';
}
});
$('#input').on('input', function() {
if ($(this).val().length > 140) {
$('#demo').text('Ваш текст');
} else {
$('#demo').text('');
}
});
const $navLink = $('.nav__link');
const activeClass = 'active';
const navClass = localStorage.getItem('add-class');
if (navClass) {
$navLink
.removeClass(activeClass)
.eq(navClass)
.addClass(activeClass);
}
$navLink.on('click', function() {
$navLink.removeClass(activeClass);
$(this).addClass(activeClass);
localStorage.setItem('add-class', $(this).index());
});
document.querySelectorAll('h2').forEach(h => {
if (h.innerText === 'тест') {
h.style.display = 'none';
}
});
document.querySelector('#yandex').setAttribute('data-kino', document.querySelector('.topic-alt').innerHTML);
window.onload = function () {
function createElement(text) {
let div = document.createElement('div');
div.innerHTML = `${text}`;
document.body.appendChild(div); // тут
}
createElement('Lorem ipsum dolor sit amet, consectetur adipisicing elit.');
};
range.addEventListener('input', () => {
input.value = range.value;
if (input.value >= 50) {
range.setAttribute('step', '10');
} else {
range.removeAttribute('step');
}
});