本文介绍了这个jquery $('。some-class',$('#some-id'))是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 context , some-class 将在元素中使用id some- ID 。


$ b

'。some-class'是选择符, $('#some-id ') is context

jQuery文档中选择器的语法是 jQuery(selector [,context])您可以阅读更多关于选择器 如果没有上下文 $('。some-class')将带有文档中的所有元素-类。 使用上下文 $('。some-class',$('#some-id'))将带有元素的所有元素与id some-id 。


i know the meaning of $('.some-class') and $('#some-id'), but i do really not know the meaning of $('.some-class',$('#some-id')), hoping some one can explain it for me, many thanks.

解决方案

You have selector with context, some-class will be looked up in element with in element with id some-id.

'.some-class' is selector and $('#some-id') is context

The syntax in the jQuery documents for selector is jQuery( selector [ , context ] ) you can read more about selectors here

Without context $('.some-class') will bring all the elements in document with class some-class. With context $('.some-class', $('#some-id')) will bring all the elements with in element with id some-id.

这篇关于这个jquery $('。some-class',$('#some-id'))是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 04:17