当前位置: 代码迷 >> JavaScript >> jquery有关问题?
  详细解决方案

jquery有关问题?

热度:159   发布时间:2012-04-08 14:38:30.0
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
  相关解决方案