본문 바로가기
반응형

JAVASCRIPT/JQuery12

[JQuery] 자식창에서 부모창 제어하기 $("#부모창Element ID",opener.document).val("바꿀 값"); 2018. 9. 12.
[JQuery] Parent(부모), ChildI(자식) 이벤트 문제 $(document).on('click','.test',function(){ alert('test'); }); $(document).on('click','.test2',function(){ alert('test2'); }); 본인은 div test class를 클릭하면 test가 alert창에 띄워지고 div test2 class 를 클릭하면 test2가 alert에 띄워질줄알았지만, javascript는 부모 자식간에 이벤트를 전파(버블링)하는 속성이 있기때문에 부모 class인 test 의 자식클래스 test2를 클릭해도 alert에 test가 띄워지게 된다. 그래서 해결방법으로는 부모의 이벤트전파를 막는 속성인 문구를 하나 추가해주면된다. //jQuery 사용할경우 $(document).on('cl.. 2018. 8. 30.
[JQuery] 동적으로 element append시 Click Event 문제 JQuery로 append를 하게되면 기본 html onclick="function()"을 사용 할 수 없다. $(document).on('click','element id or class',function(){ alert(pcode); }); 2018. 8. 30.
[JQuery] 브라우저 해상도 알아내기 $(document).ready(function(){ let windowWidth = $( window ).width(); let windowHeight = $( window ).height(); alert(windowWidth); alert(windowHeight); }); 2018. 8. 28.
[JQuery] 서버단에서 Object를 받았을때 javascript단에서 Object의 크기 알아내기 $(document).ready(function(){ $.ajax({ type : 'GET', url : '/userinfo', success : function(response) { if (Object.keys(response).length > 0) { alert('length > 0'); } else { alert('length < 0') } }, error : function(e) { alert("ERROR : " + e.statusText); } }); }); 2018. 8. 20.
[JQuery] tab menu 예제 https://github.com/alizahid/slinky/blob/master/dist/slinky.min.js 2018. 8. 16.
반응형