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

227
Visualizações
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 Respostas
Responde à pergunta

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 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