.focusin (handler) 정보
jQuery .focusin (handler)본문
.focusin (handler)
설명 : 이벤트 핸들러를 "focusin"이벤트에 바인딩하십시오.
이 방법은 .on( "focusin", handler )첫 번째 두 가지 변형과 .trigger( "focusin" )세 번째 변형에 대한 바로 가기입니다 .
이 focusin이벤트는 요소 나 요소 내부에 포커스가있을 때 요소로 보내집니다. 이는 부모 요소에서 포커스 이벤트 감지를 지원한다는 점에서 포커스 이벤트와 다릅니다 (즉, 이벤트 버블 링을 지원함).
이 이벤트는 focusout 이벤트 와 함께 사용됩니다 .
추가 참고 사항 :
.focusin()방법은 단지 약어 .on( "focusin", handler )일 뿐이 므로 분리는 사용이 가능합니다 .off( "focusin" ).
예:
페이지의 단락 내에 초점이 맞는지 살펴보십시오.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>focusin demo</title>
<style>
span {
display: none;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<p><input type="text"> <span>focusin fire</span></p>
<p><input type="password"> <span>focusin fire</span></p>
<script>
$( "p" ).focusin(function() {
$( this ).find( "span" ).css( "display", "inline" ).fadeOut( 1000 );
});
</script>
</body>
</html>
0
댓글 0개