P

jQuery w3schools 한글판 강좌23 - Commonly Used jQuery Event Methods - on() 메소드

· 2017-03-14 (화) 00:05:15 · 3629

 jQuery w3schools 한글판 강좌23 - Commonly Used jQuery Event Methods - on() 메소드

 

The on() Method

on() 메소드는 선택된 요소들에 대한 한개 이상의 이벤트 핸들러를 붙여준다

 

click 이벤트를  한개의 <p>요소에 붙이는 예:

 

Example

$("p").on("click", function(){
    $(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");
    } 
});

 

 

|
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
jQuery 17-03-18 조회 2,796
jQuery 17-03-18 조회 2,376
PHP 17-03-18 조회 4,395
jQuery 17-03-17 조회 2,246
jQuery 17-03-17 조회 2,294
jQuery 17-03-17 조회 2,146
jQuery 17-03-17 조회 3,153
PHP 17-03-16 조회 2,413
PHP 17-03-16 조회 2,242
PHP 17-03-16 조회 2,449
기타 17-03-16 조회 1.6만
OS 17-03-16 조회 3,527
jQuery 17-03-15 조회 2,580
jQuery 17-03-15 조회 2,648
jQuery 17-03-15 조회 2,751
jQuery 17-03-14 조회 2,548
jQuery 17-03-14 조회 2,673
jQuery 17-03-14 조회 3,630
PHP 17-03-13 조회 2,588
PHP 17-03-13 조회 2,384
PHP 17-03-13 조회 2,651
PHP 17-03-11 조회 2,374
PHP 17-03-11 조회 3,059
PHP 17-03-11 조회 2,731
jQuery 17-03-11 조회 2,723
jQuery 17-03-11 조회 2,826
jQuery 17-03-11 조회 2,248
jQuery 17-03-10 조회 2,253
jQuery 17-03-10 조회 2,252
jQuery 17-03-10 조회 2,625