.trigger('click') 과 .on('click')의 차이점은 trigger는 클릭이벤트를 강제로 실행시키는 것
click말고도 여러가지 event들을 사용할 수 있다.
$(selector).trigger(event,eventObj,param1,param2,...)
내가 직접실행하지 않아도 강제로 이벤트가 실행된다.
https://www.w3schools.com/jquery/event_trigger.asp
jQuery trigger() Method
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com
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
'Front > JS & jQuery' 카테고리의 다른 글
[jquery][datatables] 열너비조정 함수모음 (0) | 2022.06.04 |
---|---|
[js][datatables] columns.adjust() (0) | 2022.06.02 |
[jQuery] .attr() .prop() 차이 (0) | 2022.05.30 |
[JS] 여러개의 값 리턴하기 (0) | 2022.05.27 |
[jQuery] [error]동적으로 selectbox selected옵션 추가할 때 에러 (0) | 2022.05.26 |