为了账号安全,请及时绑定邮箱和手机立即绑定

为什么是这样的

var html = document.getElementsByTagName('html')[0];

console.log(html.parentNode);            //#document

console.log($('html').parentNode);        //undefined

console.log($('html').parent()[0]);        //#document

console.log(ajQuery.parent($('html')));    //null

正在回答

2 回答

因为通过$获取到不是DOM对象,而是jQuery对象,DOM对象的原生属性,在jQuery对象上是没有的,可以$('element')[0] 这样就获取到DOM对象了

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

为什么是这样的

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信