Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6741145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:41:24+00:00 2026-05-26T11:41:24+00:00

Okay, so we have around 30 input boxes in our page, and instead of

  • 0

Okay, so we have around 30 input boxes in our page, and instead of writing a no data line for each one, we have a simple statement:

if( $(div).find('input:text[value=""]').length > 0 ||
    $('#checkbox1Wrap').find('input:checkbox:not(:checked)').length > 0 ||
    $('#checkbox2Wrap').find('input:checkbox:not(:checked)').length > 0 ||
    $(div).find('select option:first-child:selected').length > 0 ||
    $(div).find('textarea').val() == ""
){
    $(div).prepend('<p class="field_help"> Please complete all fields before moving to next step</p>');
    return false;
}

This checks all input fields to check if their length is more than 0, but we want to exclude certain fields from being checked.

For example:

<input type="text" autocomplete="off" value="" name="ext" id="ext">

We don’t want the above input field to be checked.

How can we make it so the if statement skips certain defined IDs?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:41:24+00:00Added an answer on May 26, 2026 at 11:41 am

    You can use the .not() method:

    $(div).find('input:text[value=""]').not('#id1, #id2')
    

    Docs here: http://api.jquery.com/not/

    I should note that one standard way of doing this is a bit simpler, however, if you don’t mind mixing the business logic of the form with your HTML markup:

    1. In HTML, add a required CSS class to all required elements.

    2. In jQuery, specify that class in your selector:

      `$(div).find('input.required:text[value=""]')`
      

    Now only required elements are validated. There are a couple of advantages to this approach:

    • You can easily use CSS to visually indicate required fields
    • The selectors are simpler
    • If you decide you need more complex validation, you’re already set up to use jquery-validation

    You could do the same thing in the opposite direction using an optional class too, but I think required is a bit better semantically.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, so I have this page, which has one Ajax:AsyncFileUploader also some other ajax
Okay. I have completed my first python program.It has around 1000 lines of code.
Okay, I have a page on and on this page I have an iframe.
Okay, so you have a load of methods sprinkled around your system's main class.
Okay, so I understand all of us C/C++ programmers have at one time met
Okay, I have been messing around with different sorting algorithms in Ruby; mainly variations
Okay, I have a struct, TextBlock , that simulates moving blocks of text around
Okay, so I have this T-SQL statement: SELECT COUNT(DISTINCT RentalNo) as Count FROM RoomRental
Okay let me start off by saying I have been looking around a lot
Okay I have this RewriteRule which is supposed to redirect any request for the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.