0
我無法通過jQueryMobile中的類選擇頁面內容。無法通過jQueryMobile中的類選擇頁面內容
$('div[data-role="content"]');
工作正常
$('div.ui-content');
只選擇少數
我無法通過jQueryMobile中的類選擇頁面內容。無法通過jQueryMobile中的類選擇頁面內容
$('div[data-role="content"]');
工作正常
$('div.ui-content');
只選擇少數
jQuery Mobile的添加類時它增強這一頁。完成增強之前,您可能會調用選擇(我不會猜測沒有了,這是你的應用程序;))
正確的方式來獲得所有的內容節點是:
$("div:jqmData(role='content')")
你應該忽略空白,沒有
$('div .ui-content');
但
$('div.ui-content');
不工作,行爲是一樣的。 「div .ui-content」和「div.ui-content」有什麼區別? – 2011-06-07 12:54:23
與空白:http://api.jquery.com/descendant-selector/ – sustainablepace 2011-06-07 12:58:04
我剛剛檢查了我的項目,我總是得到與兩個選擇器相同的金額。由於類的ui-content是由jQuery Mobile設置的,我認爲你的HTML不符合jQuery Mobile的方式,請參閱http://jquerymobile.com/demos/1.0a4.1/#docs/pages/docs-pages html的。也許在jsfiddle中添加你的HTML並鏈接它。 – sustainablepace 2011-06-07 13:08:03