Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

165
Visualizações
Button disabled when data is call over still?

button is disable even through the input got value till i have to manually remove and add in the the button become enabled ?

I got this javascript script where i am am able to disable my button however when the data put the input field some value the button is still disabled despite being that that some value in it till i have to manually click on the input field to edit

This is what i mean button is disabled still when i type in my password field enter image description here

How can i able to disable the button still if value is none but button enable when there value in it?

$('input[type="email"]' && 'input[type="text"]' && 'input[type="password"]' && 'input[id="confirm_password"]' && 'input[id="validationName"]').keyup(function() {
  if ($(this).val() != '') {
    $(':button[type="submit"]').prop('disabled', false);

  } else {
    $(':button[type="submit"]').prop('disabled', true);

  }
});

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You could filter

Alternatively give all fields a required attribute, then the form cannot be submitted

const $fields = $('input[type="email"], input[type="text"], input[type="password"], input[id="confirm_password"], input[id="validationName"]')
const dis = function() {
  const empty = $fields.filter(function() {
    return this.value === ''
  }).length > 0;
  $(':button[type="submit"]').prop('disabled', empty)
};
$fields.keyup(dis)
dis()
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<form id="myForm">
  <input type="email" value="@" />
  <input type="text" />
  <button  type="submit">Submit</button>
</form>

about 4 years ago · Juan Pablo Isaza Relatório

0

If you are using jQuery, I believe you need to use comma separator , instead of &&. You could also optimize the if...else by directly assigning the boolean value to disabled prop.

$('input[type="email"], input[type="text"], input[type="password"], input[id="confirm_password"], input[id="validationName"]').keyup(function() {
  $(':button[type="submit"]').prop('disabled', $(this).val() === '');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<input type="email"  value="@"/>
<input type="text" />
<input class="button" type="submit" />

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda