반응형
자바 펼쳐가 입력에 점점이 맞는지 감지 [중복]
이 질문에 이미 답변이 있습니다.
- jQuery를 사용하여 입력에 점점이 테스트 15 답변
.click
텍스트 영역이 이미 포커스 된 경우 이벤트가 트리거되는 시기를 어떻게 감지?
이 jquery가 있습니다.
$(".status").on("click","textarea",function(){
if ($(this) == "focused") {
// fire this step
}else{
$(this).focus();
// fire this step
}
순수 자바 펼쳐 사용 :
this === document.activeElement // where 'this' is a dom object
또는 jquery의 :focus
의사 선택기로.
$(this).is(':focus');
jQuery의 .is ( ": focus") 사용
$(".status").on("click","textarea",function(){
if ($(this).is( ":focus" )) {
// fire this step
}else{
$(this).focus();
// fire this step
}
시도해 실험 니 :
$(this).is(':focus');
한 번 봐 가지고 입력 포커스가있는 경우 시험에 jQuery를 사용 하여이 좀 더 많은 예제를 제공합니다
JQuery를 사용할 수있는 권한 이 있습니다. JQuery : 포커스 선택기 를 사용 하면 필요한 작업을 수행 할 수 있습니다.
$(this).is(':focus');
참고 URL : https://stackoverflow.com/questions/17614844/javascript-detect-if-input-is-focused
반응형
'IT' 카테고리의 다른 글
둘 이상의 리소스를 "사용"하면 리소스 누수가 수 있습니까? (0) | 2020.08.09 |
---|---|
유효한 정수인지 테스트 (0) | 2020.08.09 |
AngularJS ng-repeat에서 반복되는 요소의 계산 (0) | 2020.08.09 |
params [: something]에서 필드를 제거하는 방법 (0) | 2020.08.09 |
최고의 CSS 프레임 워크는 무엇이며 그만한 가치가 있습니까? (0) | 2020.08.09 |