2011-05-24 43 views
0

我有这样的XML文档:中的XML元素名逃逸期间使用jQuery

<subpages> 
    <page.subpage> 
    <title>blah</title> 
    </page.subpage> 
</subpages> 

但是当我通过每个page.subpage尝试循环,什么都不会返回。

$(xml).find("page.subpage").each(function() { 
    console.log("found something!"); 
} 

我猜为什么不返回任何事做与周期?我已经尝试过HTML转义它与&#46;,但它似乎没有工作。

+0

可能欺骗:http://stackoverflow.com/questions/350292/how-do-i-get-jquery-to-select-elements-with-a-period-in-their-id – MikeM 2011-05-24 04:07:01

回答

0

尝试

$(xml).find("page\\.subpage").each(function() { 
    console.log("found something!"); 
} 
0

XML选择器的价值是什么?你是如何设定的?尝试运行一些JavaScript调试器(萤火虫?),看看你是否甚至进入每个功能。