jQuery选择器中直接后代(>)与后代有什么区别? [英] What is the difference direct descendent (>) vs. descendant in jQuery selectors?
本文介绍了jQuery选择器中直接后代(>)与后代有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这两个jQuery语句有什么区别?他们似乎通过获取所有子div标签来做同样的事情.
What's the difference between these two jQuery statements? They seem to do the same thing by getting all the children div tags.
$("#mainblock div")
$("#mainblock > div")
推荐答案
$("#mainblock > div")
=仅儿童级别
$("#mainblock div")
=所有child +后代.
$("#mainblock div")
= all the childs+ desendents.
这篇关于jQuery选择器中直接后代(>)与后代有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文