我不是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");
});
});