0

I'm having the following Jquery code:

$('div:jqmData(wrapper="true"):jqmData(ex="true") div:jqmData(role="page")').each(function(index) { 
     // do sth 
     });

I want to replace $('div:jqmData(wrapper="true") with my variable page.

Question:
How do I get the above syntax working with my variable page? This is not really working:

page.is(':jqmData(ex="true")').find('div:jqmData(role="page")').each(function() { 
   // do sth 
   });

Thanks for some inputs!

2 Answers 2

1

.is returns a boolean indicating whether the selector applies to one ore more elements in the set. To filter the current set, use .filter instead:

page.filter(':jqmData(ex="true")').find(...)
Sign up to request clarification or add additional context in comments.

Comments

0

The is function in jquery only return true of false, so you can use it in an if statement like below:

if(page.is(':jqmData(ex="true")'))
{
    page.find('div:jqmData(role="page")').each(function() { 
        // do sth
    });
}

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.