Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

171
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda