1

I'm trying to add multiple criteria to JQuery find() and couldn't make any progress.

Working code

$("#left-menu-bar").find("li:not(.login)").each(function(){loadframe(this);})

I'm trying to add logout class as well to the above find criteria and couldn't make it work.

My attempt:

$("#left-menu-bar").find("li:not(.login)").find("li:not(.logout)").each(function(){loadframe(this);})
2
  • Any error you see in the browser devtool console? What is not working ? let us know please. Commented Jan 14, 2020 at 17:56
  • First line of code is returning all the ListItems that matches the selection criteria. where as the second line of code is not returning anything Commented Jan 14, 2020 at 18:02

1 Answer 1

1

You can use multiple CSS selectors in not(), so just change your selector to this:

$("#left-menu-bar").find("li:not(.login,.logout)").each(function(){loadframe(this);})
Sign up to request clarification or add additional context in comments.

1 Comment

Yoo.. That is easy peasy.. Thanks much !!! You saved a lot of time. I regret not posting it earlier. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.