Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

238
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!