<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("input").focus(function(){ //포커스를 얻었을때
$(this).css("background-color", "#cccccc"); //바탕을 회색으로 바꿈
});
$("input").blur(function(){ //포커스를 잃었을때
$(this).css("background-color", "#ffffff"); //바탕을 다시 흰색으로 바꿈
});
});
</script>
</head>
<body>
Name: <input type="text" name="fullname"><br>
Email: <input type="text" name="email">
</body>
</html>
'개발하자 > jQuery' 카테고리의 다른 글
원하는 태그의 css값 얻어오기 (0) | 2015.02.27 |
---|---|
원하는 태그에 css적용시키기 (0) | 2015.02.27 |
클릭한 버튼 원하는 값으로 바꾸기 (0) | 2015.02.27 |
원하는 버튼에 이벤트주기 (0) | 2015.02.27 |
모드 버튼에 이벤트 주기 (0) | 2015.02.27 |