개발Story
[Javascript] jquery. keypress(중복 키 조합)
Javascript/jquery 2022. 11. 13. 18:49

$(document).bind('keypress', (event) =>{ // shift + a 조합키 if( event.which === 65 && event.shiftKey ) { console.log('shift + a 조합키 감지') } }); jquery를 이용하여 사용자 키보드 입력에 대한 이벤트를 감지가 가능하다. shift, ctrl, alt, meta 키와 일반 키를 동시에 눌렀을 때 위와 같은 방식으로 이벤트를 줄 수 있다. event.shiftKey event.ctrlKey event.altKey event.metaKey [keyCode 표] 출처 : https://im-developer.tistory.com/20 키 코드 : https://www.cambiaresearch.com/a..

article thumbnail
[Javascript] select2 기능(jquery)
Javascript/jquery 2021. 3. 14. 19:01

웹페이지를 개발하면서 select box의 리스트가 많을경우 검색이 힘든 경우가 많다. 그럴때 select2기능을 사용하면 편하다. select2 기능을 사용하기 위해선 js랑 css가 필요하다. [Import] [설정] 위와 같은 이미지의 selectbox를 설정할 수 있다. 물론 검색도 가능하다. 원하는 selectbox를 객체를 잡아서 사용법 : $("#아이디").select2(); 이런식으로 선언해주면 된다. 또는 select box의 oncheange 이벤트가 필요할 경우 $("#아이디").on('select2:select', function(e){ console.(e) /// 이벤트 객체를 잡을 수 있다.여기서 처리해주면 된다. } [옵션] $("#아이디").select2({ maximumSe..