Jam's story

[JQuery] on() 메소드 본문

WEB/JQuery

[JQuery] on() 메소드

애플쩀 2022. 6. 10. 15:42
<script>
   $(function (){
	  /*
	   $("button")
	           .click(function (){
		          $(this).hide();
	           })
	           .mouseenter( func);
	  */
	    
	   /*[암기] jquery Ajax 처리할 때는  on("이벤트 ")
	   $("button").on("click", function (){
		   $(this).hide();
	   });
	    */
	    
	    // 하나 이상의 이벤트 핸들러를 연결할 때 사용하는 메서드 
	    $("button").on({
	    	mouseenter : function (){
	    		$(this).css("background-color", "lightgray");
	    	},
	    	mouseleave : function (){
	    		$(this).css("background-color", "lightblue");
	    	},
	    	click: function (){
	    		$(this).css("background-color", "yellow");
	    	}
	    });
   });
</script>
Comments