<div id="contentChildren" class="frame">
<div id="icon_com.tms.cms.article.Article_fc7be680-c0a8c88d-1be20c00-e3a2814e">
<a class="contentItem Article" href="http://localhost:9080/ekms/contentexplorer /explorer.jsp?cn=contentExplorer.panel&et=openMenu&contentId=com.tms.cms.article.Article_fda4d360-c0a8c88d-ae8af400-e4f04255">
</div>
</div>
我有上面的html。我尝试使用 jquery 选择 .这是“icon_com.tms.cms.article.Article_fc7be680-c0a8c88d-1be20c00-e3a2814e”的div id
但是好像无法选择。我尝试使用
$("icon_com.tms.cms.article.Article_fc7be680-c0a8c88d-1be20c00-e3a2814e").html();
但它返回 null。这是我使用的功能
function _clickMenu(){
var parent = $(this).parent();
var name = $(this).attr("name");
var id = parent.attr("id");
id = id.substr(5);
$.getJSON(this.href, function(data){
});
var icon = "#icon_"+id;
var x = $("#icon_com.tms.cms.article.Article_fc7be680-c0a8c88d-1be20c00-e3a2814e");
alert("x : " + x.html());
return false;
}
谁能帮我吗?
最佳答案
我认为由于选择器中有 .
,因此将其作为类选择器。
只是尝试类似的事情
$('div[id="icon_com.tms.cms.article.Article_fc7be680-c0a8c88d-1be20c00-e3a2814e"]').html()
关于Jquery无法选择div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8891167/