我需要一些帮助。看看你是否可以帮助我。 我有一个函数,其形式是:
$this.find(settings.selector).each(function(index) {
无论如何,根据变量可以更改选择器如下:
$this.each(function(index) {
你能告诉我怎么做吗?我希望我已经大致解释过了。
谢谢。
答案 0 :(得分:4)
您可以使用像
这样的临时变量var $els;
if (some_condition) {
$els = $this.find(settings.selector)
} else {
$els = $this;
}
$els.each(function (index) {});