jQuery w3schools 한글판 강좌23 - Commonly Used jQuery Event Methods - on() 메소드 정보
jQuery jQuery w3schools 한글판 강좌23 - Commonly Used jQuery Event Methods - on() 메소드본문
jQuery w3schools 한글판 강좌23 - Commonly Used jQuery Event Methods - on() 메소드
The on() Method
on() 메소드는 선택된 요소들에 대한 한개 이상의 이벤트 핸들러를 붙여준다
click 이벤트를 한개의 <p>요소에 붙이는 예:
Example
$("p").on("click", function(){
$(this).hide();
});
$(this).hide();
});
여러개의 이벤트 핸들러를 한개의 요소에 붙이는 예:
Example
$("p").on({
mouseenter: function(){
$(this).css("background-color", "lightgray");
},
mouseleave: function(){
$(this).css("background-color", "lightblue");
},
click: function(){
$(this).css("background-color", "yellow");
}
});
추천
0
0
댓글 0개