我不是最好的jQuery的东西。但我试图从函数中分离出动作,这样我就可以应用多个导致相同功能的事件。不幸的是,这是行不通的。有人知道为什么如何将多个事件应用于相同的功能
更新功能,但仍错误
$(document).ready(function() {
var $info_items = jQuery('.checkbox.has_info, .has_info');
$info_items.click(function(event) {
$(this).show_text(event);
});
// I suspect it has something to do with this initalizer of the function here
jQuery.fn.show_text = function(event){
var $info_item = jQuery(this);
$info_items.filter(function(index){
return $(".hidden_text").css("display","block");
}).not($info_item).parent().next().next().hide("slow");
$info_item.parent().next().next().show("fast");
});
});
下次请使用更好的主题行。也许就像“如何将多个事件应用于同一个功能”。 – Bart 2010-08-18 18:18:30