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 8862003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:37:23+00:00 2026-06-14T15:37:23+00:00

Is it possible to select all elements with a certain class, but not if

  • 0

Is it possible to select all elements with a certain class, but not if they contain certain .text()?

Here is what I have so far –

<div class="test">0</div>
<div class="test">1</div>
<div class="test">2</div>
<div class="test">3</div>
<div class="test">4</div>

var divList = $(".test").toArray();
var divLength = divList.length;

What I want to do with this code is to not include the <div> with the 0 in it.

  • 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-06-14T15:37:24+00:00Added an answer on June 14, 2026 at 3:37 pm
    $('.test').not(':contains(0)')
    

    http://api.jquery.com/contains-selector/

    Incidentally, to answer epascarello’s question, this will match ANY substring ANYWHERE inside the element. If your numbers go up to 10, it will match and discount that one as well. You’ll need a custom selector or a .filter() function if that’s an issue for you.

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

Sidebar

Related Questions

Is there a JQuery selector to select all elements which do not have certain
Using a jQuery selector, is it possible to select all elements that are not
I'm looking to make a selector which will select all elements if they have
Possible Duplicate: jQuery get all divs which do not have class attribute I need
It is possible in SQL Server Express have a log of all operations SELECT
I would like to select all elements within a container e.g. a div. It
I want to select all HTML <span> elements that don't have an id equal
In jQuery it's possible to select all elements that start/end with something. = is
Possible Duplicate: Select div with specific width Is there a way to select all
Possible Duplicate: JQuery, is there a way to select all elements on the page

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.