2013-04-11 2 views
0

이 청취자는 현재 아래에 표시된 div의 ref에서 클릭으로 트리거됩니다. jquery를 사용하면 어떻게 프로그래밍 방식으로 이벤트를 트리거 할 수 있습니까? 청취자를 다시 쓰는 것이 더 나을 수도 있습니다.jquery - 프로그램 방식으로 트리거 리스너

$("#flipPad a:not(.revert)").bind("click",function(){ 
    var $this = $(this); 
    $("#flipbox").flip({ 
     direction: $this.attr("rel"), 
     color: $this.attr("rev"), 
     content: $this.attr("title"), 
     onBefore: function(){$(".revert").show()} 
    }) 
    return false; 
}); 

HTML :

<div id="flipbox">Message1</div> 
<div id="flipPad"> 
<a href="#" class="left" rel="rl" rev="#39AB3E" title="Change content as <em>you</em> like!">left</a> 
</div> 
+0

의 중복 가능성 [jQuery를 - 프로그래밍 트리거 이벤트 (http://stackoverflow.com/questions/2700231/jquery-programmatically-trigger-event) – jahroy

답변

1

당신은이 작업을 수행 할 수 있습니다

$('#flipPad a:not(.revert)').click(); 

당신은이 작업을 수행 할 수 있습니다 문서에

$('#flipPad a:not(.revert)').trigger('click'); 

링크 :

1

이이 프로그램을 트리거한다 (이벤트 처리기를 화재) :

$("#flipPad a:not(.revert)").click(); 
관련 문제