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

228
Vistas
Validate all input fields on the page on click with jquery

I'm totally new to jquery, but trying my best.

I have an asp.net mvc project with page full of x-editable inputs. I made this simple button

<input type="button" class="btn btn-info" id="validate" value="Validate document" />

What I want to achieve is after inputs has been filled by the user, I want him/her to push the button and check if all fields has been filled. I made this jquery:

 $('.editable').ready(function () {
        $('.editable').editable('option', 'validate', function (v) {
            if (!v) return 'Field required!';
        });
    })

When I push enter on an empty field it triggers validation. enter image description here

What I need is to highlight all empty x-editable fields on the page when the #validate is clicked and show "Field required!" message.

Any help would be appreciated

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try this,

$("input:empty").length == 0;

If it's zero, none are empty.

To filter items with just spaces in, you could do:

$("input").filter(function () {
    return $.trim($(this).val()).length == 0
}).length == 0;
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