first와 first-child 차이
$("ol li:first").css("background-color", "pink"); //전체에서 첫번째 li
$("ol li:first-child").css("background-color", "pink"); //각 ol 항목의 첫번째 li
contains( )
$("li:contains(라면)").css("background-color", "powderblue"); //전체항목에서 라면 찾음
홀수번지, 짝수번지
$("li:odd").css("border", "2px solid black"); //홀수번지 찾음, 짝수: even
Clone()
$("#btn2").click(function () {
var no2 = $("#box2").find("img").clone();
$("#box4").append(no2);
});
폼 태그
focus( ) / blur( )
//포커스 이동 시
$("input:text, input:password").focus(function () {
$(this).css("background-color", "pink");
});
//포커스 벗어날 시
$("input:text, input:password").blur(function () {
$(this).css("background-color", "white");
});