나는이 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