jQuery:如何仅在选择范围内进行选择? [英] Jquery: How to select only within a selection?

查看:86
本文介绍了jQuery:如何仅在选择范围内进行选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

var parent = $("#jcontent");
var button1 = parent(".button1")

在不重用#jcontent的情况下如何选择.button1知道它在父级内部?

How to select .button1 knowing it is inside the parent while not reusing #jcontent?

我需要这样做,因为我只想将父级作为参数传递并能够对其进行高速缓存.

I need to do this because I only want to pass the parent as parameter and to be able to cache it which is faster.

推荐答案

另一种选择

var parent = $("#jcontent"); 
var button1 = $(".button1", parent) ;

这篇关于jQuery:如何仅在选择范围内进行选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆