티스토리 뷰

💼 정보 ver1.0

.focus()

James Wetzel 2012. 9. 12. 13:09
728x90
반응형

Description: Bind an event handler to the "focus" JavaScript event, or trigger that event on an element.



<!DOCTYPE html>
<html>
<head>
 
<style>span {display:none;}</style>
 
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
 
<p><input type="text" /> <span>focus fire</span></p>

<p><input type="password" /> <span>focus fire</span></p>
<script>
    $
("input").focus(function () {
         $
(this).next("span").css('display','inline').fadeOut(1000);
   
});
</script>

</body>
</html>



상세 설명: http://api.jquery.com/focus/

728x90
반응형