.focusin (handler)

· 2017-10-11 (수) 14:02:46 · 2012

.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>

|
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
jQuery 17-10-11 조회 2,430
jQuery 17-10-11 조회 1,899
jQuery 17-10-11 조회 2,013
jQuery 17-09-29 조회 2,236
jQuery 17-09-29 조회 2,482
jQuery 17-09-29 조회 2,022
jQuery 17-09-26 조회 1,944
jQuery 17-09-26 조회 2,031
jQuery
[jQuery]
17-09-26 조회 1,803
jQuery 17-09-22 조회 2,047
jQuery 17-09-22 조회 2,104
jQuery 17-09-22 조회 2,092
jQuery 17-09-21 조회 2,270
jQuery 17-09-21 조회 2,220
jQuery 17-09-21 조회 2,090
jQuery 17-09-19 조회 2,143
jQuery 17-09-19 조회 1,901
jQuery
[jQuery]
17-09-19 조회 1,882
jQuery
[jQuery]
17-09-18 조회 2,068
jQuery 17-09-18 조회 1,982
jQuery 17-09-18 조회 1,672
jQuery 17-09-14 조회 2,084
jQuery 17-09-14 조회 1,780
jQuery 17-09-14 조회 2,027
jQuery 17-09-11 조회 2,421
jQuery 17-09-11 조회 2,443
jQuery 17-09-11 조회 1,970
jQuery 17-09-10 조회 2,035
jQuery 17-09-10 조회 2,456
jQuery
[jQuery]
17-09-10 조회 1,916