<div class="night">
Какой-то текст
</div>
div {
color: #000;
background: #fff;
}
.night {
padding: 15px;
color: #fff;
background: #000;
}
let element = document.querySelector('div');
setInterval(() => {
if(new Date().getHours() < 22) {
element.classList.remove('night');
}
}
, 1000);
input.addEventListener('input', () => {
// code
})
<button>OK</button> на <button onclick="obr()">OK</button>
(function() {code}()) на function obr(){}
<button type="button" data-id="about" class="js-item-link is-active">
<span>Дата</span>
</button>
<button type="button" data-id="works" class="js-item-link">
<span>Время</span>
<span>13:00 (МСК)</span>
</button>
</div>
<div class="modal-buy-card__tab-container">
<div class="tab_content is-active" id="about">
<input class="modal-buy-card__date-calendar flatpickr flatpickr-input active" type="text" readonly="readonly">
<div>
<button>отмена</button>
<button onclick="obr()">OK</button>
</div>
</div>
<div class="tab_content" id="works">
<p>Works Works Works Works Works Works Works Works Works Works Works Works Works Works Works Works Works Works Works Works WorWorks Works Works Works Works Works Works Works Works Works Works Works Works Works Works Works Works Works Works Works Works</p>
</div>
</div>
<script type="text/javascript">
function obr(){
alert("проверка кнопки!_!")
let tabMenus = document.querySelectorAll('.js-item-link');
let tabContents = document.querySelectorAll('.tab_content');
for (var i = 0; i < tabMenus.length; i++) {
tabMenus[i].addEventListener('click', function(e) {
e.preventDefault();
for (var i = 0; i < tabMenus.length; i++) {
tabMenus[i].className = 'js-item-link';
}
this.className = 'js-item-link is-active';
for (var i = 0; i < tabContents.length; i++) {
tabContents[i].className = 'tab_content';
}
document.getElementById(this.dataset.id).className = 'tab_content is-active';
});
}
};
</script>
const ta = document.querySelector(...) // textarea
const counter = document.querySelector(...) // счётчик
ta.addEventListener('input', onInput)
funcion onInput(evt) {
const length = evt.target.value.length
counter.textContent = length
}
phoneInput.addEventListener('focus', () => {
phoneInput.placeholder = 'Ваш номер'
})
phoneInput.addEventListener('blur', () => {
phoneInput.placeholder = '+7 (___)___-__-__'
})
main
- главная обертка для сменяемой части кода(условно шапка и подвал у вас не меняются).section
- используется для выделения смысловых блоков, как вы и указали. ajaxRequest().then(() => {
window.location.href = 'http://www.example.com'
})
document.querySelector('.reviews__commentaries.value-commentaries').addEventListener('click', function(){
this.parentNode.nextElementSibling.classList.toggle('slide-tooggle');
this.parentNode.nextElementSibling.nextElementSibling.classList.toggle('slide-tooggle');
this.nextElementSibling.classList.toggle('rotate-comment');
});
.reviews__response-comment{
-webkit-transition: height .3s ease;
height: 0;
overflow: hidden;
}
.reviews__response-comment.slide-tooggle {
height:100px;
}
gap: 10px 20px;