상세 컨텐츠

본문 제목

[JavaScript/jQuery] JavaScript로 Caps Lock 체크

Development/JavaScript

by J-Developer 2020. 8. 26. 21:14

본문

반응형

JavaScript에서 Caps Lock을 체크하는 방법이다.

 

 

$("#memberPwd").on("keypress", function(e) { 
	var text = String.fromCharCode( e.which );
    if ( text.toUpperCase() === text && text.toLowerCase() !== text && !e.shiftKey ) { 
        alert("Caps Lock이 켜져있습니다."); 
    } 
});
반응형

관련글 더보기

댓글 영역