Jam's story

[JQuery] 구문 본문

WEB/JQuery

[JQuery] 구문

애플쩀 2022. 6. 12. 23:00
1. jquery 구문
  html 요소를 선택하고 나서 어떤 작업(action) 을 수행하도록 되어 있다.
  기본 구문
  ㄱ. jquery 선택자(selector) > css 선택자(selector)
  ㄴ. 액션()
  $( jquery 선택자(selector) ).액션();

 

 

문서 로드가 되어 사용할 준비가 되었을 때..

 //1번째 방법
 $(document).ready(function(){
       
        });
    }); 

//2번째 방법
    $(function(){
    
        }); 
        });

 

 

 

<p>안녕하세요 </p>
<script>
/*     $(document).ready(function(){
        $("p").click(function(){
            $(this).hide();
        });
    }); */

    $(function(){
       /*  $("p").click(function(){
            $(this).hide();
        }); */

    jQuery("p").click(function(){
        jQuery(this).hide();

    }) //jQuery 앞에 J는 소문자

    window.jQuery("p").click(function(){
        window.jQuery(this).hide();

    })


});
</script>

'WEB > JQuery' 카테고리의 다른 글

[JQuery] 애니메이션 중지  (0) 2022.06.13
[JQuery] selector 선택자  (0) 2022.06.13
[JQuery] 제이쿼리란?  (0) 2022.06.12
[JQuery] custom- animate  (0) 2022.06.10
[JQuery] Slide  (0) 2022.06.10
Comments