0

I need to be able to check if there is a div with class='active' and with a custom attribute data-popup='true' - eg: second one below.

enter image description here

How can I check if a div with these 2 characteristics exists?

I know its not correct but I have been playing with the following code:

 if($('div#mainContainer div.active div[data-unique='+urlUnique+']').length > 0) {

In the long run there will be many DIV's so it needs to find if one with this class and data attribute exists.

thx

1 Answer 1

1

This is the selector you want:

$('#mainContainer div.active[data-popup=true]');
Sign up to request clarification or add additional context in comments.

Comments

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.