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>