Показать сообщение отдельно
  #5 (permalink)  
Старый 07.01.2017, 23:36
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,075

Anna_Medvid,
// проверка input
var value = sel('.typeTxtTab').value;
var selAll = document.querySelectorAll('.typeTxtTab');
for (var i = 0; i < selAll.length; i++) {
selAll[i].addEventListener('blur', function(){
    if (this.value <=0 || this.value > 99) {
      this.style.border = '2px solid red';
      this.nextElementSibling.innerHTML = 'number must be > 0 and < 100';
      this.nextElementSibling.style.color = 'red';
      id('create').disabled = 1;
    }
    else if (this.value != this.value * 1) {
      this.style.border = '2px solid red';
      this.nextElementSibling.innerHTML = ' enter number, not later!';
      this.nextElementSibling.style.color = 'red';
      id('create').disabled = 1;
    }
    else {
      this.style.border = '2px solid green';
      this.nextElementSibling.innerHTML = ' done';
      this.nextElementSibling.style.color = 'green';
     // id('create').disabled = 0;
    };
    var ok = [].every.call( selAll, function(el) {
  return el.nextElementSibling.style.color == 'green'

  });
   ok ? id('create').removeAttribute('disabled') : id('create').setAttribute('disabled', 'disabled')

});
Ответить с цитированием