Diogo Cardoso
Diogo Cardoso

Reputation: 22277

Unable to select page contents through class in jQueryMobile

I'm unable to select page contents through class in jQueryMobile.

$('div[data-role="content"]'); works fine

$('div.ui-content'); only selects a few

Upvotes: 0

Views: 488

Answers (2)

naugtur
naugtur

Reputation: 16905

jQuery Mobile adds the class when it enhances the page. You might be calling the selector before the enhancement is done (I won't guess no more, it's your app ;) )

the correct way to get all the content nodes is:

$("div:jqmData(role='content')")

Upvotes: 2

user705616
user705616

Reputation:

You should omit the blank, not

$('div .ui-content');

but

$('div.ui-content');

Upvotes: 0

Related Questions