jquery not selector

Posted on 2016-10-20
Last Modified: 2016-10-20
I have this fiddle

If you inspect the html with the google chrome inspection tool you can see this is the html rendered.

the html rendered
Notice how my fiddle adds the class="AppleStyle1" to  any span tag whose id ends in DivImageContainer_Span2

How do i add the not selector on this line:

so basically i want to opposite of my fiddle above.

I want to add this class="AppleStyle" to  any span tag whose id doe not end in DivImageContainer_Span2

Anyone know the syntax?
Question by:maqskywalker
  • 2
  • 2

Expert Comment

by:Thomas Wheeler
ID: 41852443
I think what you want is this

Open in new window

This will apply the style to all divs that are not "DivImageContainer_Span2"

Author Comment

ID: 41852527
Sorry my fiddle was wrong, this fiddle is correct fiddle.

I tried your solution on this fiddle but that didn't work.
I'm looking for spans those id does NOT end or contains this string "DivImageContainer_Span2"

I think your solution is doing does not equal to a specific string.  I

Accepted Solution

Thomas Wheeler earned 500 total points
ID: 41852657
so you would want something like this

Open in new window

Author Closing Comment

ID: 41852894

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question