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