「jQuery入門」focus()、blur()、on() の使い方

1.focus()
$(“input”).focus(function(){
$(this).css(“background-color”, “#cccccc”);
});

2.blur()
$(“input”).blur(function(){
$(this).css(“background-color”, “#ffffff”);
});

3.on()
$(“p”).on(“click”, function(){
$(this).hide();
});

4.$(“p”).on({
mouseenter: function(){
$(this).css(“background-color”, “lightgray”);
},
mouseleave: function(){
$(this).css(“background-color”, “lightblue”);
},
click: function(){
$(this).css(“background-color”, “yellow”);
}
});

Comments are closed.