$('textarea').each(function () {
this.setAttribute('style', 'height:' + (this.scrollHeight) + 'px;overflow-y:hidden;');
}).on('input', function () {
this.style.height = 'auto';
this.style.height = (this.scrollHeight) + 'px';
});
div
нельзя размещать перед body.var myCheckbox = document.querySelector('#certificate')
var myInput = document.querySelector('#number_certificate')
myCheckbox.addEventListener('change', function(){
myInput.disabled = !myCheckbox.checked
})
SELECT * FROM message WHERE (from=1 AND to=2) OR (from=2 AND to=1)
setTimeout
в конце каждого цикла вызывает новый setTimeout
. Вы можете заменить это на один вызов setInterval()
, например.var foo = setTimeout(startTimer, 1000);
clearTimeout(foo)