日期:2014-05-16  浏览次数:20318 次

jquery问题??
用jquery取得和
var element=document.getElementById("h1");
 var text=element.childNodes[0]; 
 alert('nodeType:'+text.nodeType);// nodeType=3
用jquery怎样获得js里面nodeType相同的结果

------解决方案--------------------
$('#h1').children()[0].nodeType
------解决方案--------------------
#h1元素的html是什么,属性有哪些?贴出来。
如:<div id='h1'><p nodeType=3></p></div>
$("#h1 p[nodeType=3]")
看看jQuery手册:http://download.csdn.net/detail/dmtnewtons/4126497
------解决方案--------------------
$('#h1').contents()[0].nodeType
------解决方案--------------------
$('#h1').contents()[0].nodeType