728x90
반응형
https://api.jquery.com/trigger/
.trigger() | jQuery API Documentation
Description: Execute all handlers and behaviors attached to the matched elements for the given event type. Any event handlers attached with .on() or one of its shortcut methods are triggered when the corresponding event occurs. They can be fired manually,
api.jquery.com
$( "#foo" ).on( "custom", function( event, param1, param2 ) {
alert( param1 + "\n" + param2 );
});
$( "#foo").trigger( "custom", [ "Custom", "Event" ] );
trigger 를 발생시키고 parameter 를 보내면
function( event, param1, param2 •••) 이렇게 받아서 쓸수 있다.
728x90
반응형
'Front > JS & jQuery' 카테고리의 다른 글
[js] 단항 + 연산자 (0) | 2023.08.07 |
---|---|
[js] 문자열 숫자변환 주의 (0) | 2023.08.06 |
[jQuery] data 속성 선택자 (0) | 2023.08.03 |
[js] size() 와 length (0) | 2023.07.26 |
[js] 비교연산자 / 다른 형을 가진 값 간의 비교 / 숫자와 문자열 비교 (0) | 2023.07.25 |