Pergunta

I have 6 input fields and I need to make check and reset buttons active after all inputs were completed.Ill attach a fiddle and some code.

JSFiddle

$('.input').on('input', function() {         
  limit();
  checkBtn.disabled = false;
  resetBtn.disabled = false;        
});
Foi útil?

Solução

You could find empty inputs using a selector. If there are empty inputs, disable buttons; otherwise enable them.

$('.input').on('input', function() {         
  if($('input[value=""]').length) {
   checkBtn.attr("disabled", "disabled");
   resetBtn.attr("disabled", "disabled");
  } else {
    checkBtn.removeAttr('disabled');
    resetBtn.removeAttr('disabled'); 
  }
});
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top