您现在的位置是:首页 > 电脑技术查询 > web开发

jquery有关问题?

编辑:chaxungu时间:2022-10-02 23:14:29分类:web开发

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