Luk*_*dek 10 jquery multiple-instances this getelementbyid jquery-selectors
有没有办法让这项工作:
$(this, '#foo')
Run Code Online (Sandbox Code Playgroud)
我想要选择"this"元素和#bar.为了选择让我们说两个ID,它就像它一样简单'#foo, #bar',但当我想要这两个中的一个是"这个"时,我无法让它工作.
kri*_*ath 17
$(this, '#foo')
Run Code Online (Sandbox Code Playgroud)
上面一行将搜索this元素内侧id设置为foo,这是不是你想要的这里.
你可以使用add()这个:
var $el = $(this).add('#foo')
Run Code Online (Sandbox Code Playgroud)
现在$el将包含$(this)&$("#foo")您可以在其上执行操作.
add("selector")
| 归档时间: |
|
| 查看次数: |
6760 次 |
| 最近记录: |