在jquery命令链中再次调用子上下文中的jquery
Call jquery in a subcontext again in jquery command chain
有可能这样做吗?
jQuery(selector).jQuery(subselector).command(....)
我的代码是这样的:
$(' .species')
.filter(function () { return !$(this).data('hidden_code_ready'); }
.wrapInner('<span class="species_info" />')
.append('<a href="" class="show_species"></a>')
.data('hidden_code_ready', true)
现在,对于这些匹配的元素(.species)中的每一个,我都想在.show_species中安装点击处理程序
$('.show_species',
$(' .species')
.filter(function () { return !$(this).data('hidden_code_ready'); }
.wrapInner('<span class="species_info" />')
.append('<a href="" class="show_species"></a>')
.data('hidden_code_ready', true)
).click(...);
但这真的很尴尬。有没有可能做这样的事情:
$(' .species')
.filter(function () { return !$(this).data('hidden_code_ready'); }
.wrapInner('<span class="species_info" />')
.append('<a href="" class="show_species"></a>')
.data('hidden_code_ready', true)
.jQuery('.show_species').click(....);
最好也在jQuery 1.3.2中工作。谢谢
关闭!该函数被称为.find()
,而不是jQuery
:
$('.species')
.filter(function () { return !$(this).data('hidden_code_ready'); }
.wrapInner('<span class="species_info" />')
.append('<a href="" class="show_species"></a>')
.data('hidden_code_ready', true)
.find('.show_species').click(....);
相关文章:
- 从jQuery调用存储在Variable中的函数
- 使用ajax用jquery调用php函数
- 如何从jQuery调用PHP函数
- 在Jquery调用之间添加其他函数
- 在本例中,如何使用Jquery调用函数
- 如何从页面中的jquery调用angular js函数控制器
- 控制台.log触发,但随后的 Jquery 调用不执行任何操作
- 使用jquery调用vaadin应用程序表单php
- 通过Wordpress中的jquery调用运行php文件
- jQuery调用keyup事件不起作用
- 使用ajax从javascript/jquery调用php函数
- 上一个函数完成后,javascript/jQuery调用execute函数
- 使用 jQuery 调用 DOM HTML
- 在 jQuery 调用中编码 json
- 通过 Jquery 调用 tr 属性并找到我的内部复选框
- 如何在 JavaScript FOR 循环中生成 JQuery 调用
- 使用 jQuery 调用 PHP 端点的最有效方法
- jQuery:调用脚本时隐藏元素
- 使用 $.getJson 方法从 jquery 调用 C# MVC 控制器方法
- 如何使用jquery调用php类