jQuery 1. jQuery 시작하기
w3school에 올라와 있는 내용을 번역하면서 공부한 내용입니다.
jQuery를 시작하기 전에 알아야 하는 것들
- html
- css
- javascript
위의 주제를 먼저 공부해야 합니다.
jQuery란 무엇인가?
jQuery는 자바스크립트 함수의 모음입니다.
자바스크립트 프레임워크라고도 하지요.
jQuery는 최고의 자바스크립트 라이브러리로서 가볍고 단순합니다.
jQuery라이브러리는 다음의 것들을 담고 있습니다.
• HTML element selections
• HTML element manipulation
• CSS manipulation
• HTML event functions
• JavaScript Effects and animations
• HTML DOM traversal and modification
• AJAX
• Utilities
jQuery라이브러리를 웹페이지에 추가하는 방법
이런식으로 경로를 추가하면 됩니다.
<head>
<script
src="jquery-1.9.1.min.js"></script>
</head>
다른방법으로는 CDN을 사용하는 방법이 있습니다.
이렇게 웹상에서 구글경로를 참조하여 jQuery라이브러리가 없어도 사용가능합니다.
<head>
<script
src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
</head>
첫번째 예제
그냥 맘편하게 코딩해서 실행해 봅시다.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("p").hide();
});
});
</script>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
</body>
</html>
버튼을 클릭하면 <P>태그로 작성된 부분이 사라지는 것을 확인할 수 있습니다.
jQuery 다운받는 곳
이곳에는 올드버전부터 최신버전까지 있습니다.
'WEB_TECH > jquery' 카테고리의 다른 글
[jQuery] 8. HTML Set (0) | 2013.04.22 |
---|---|
[jQuery] 7. HTML Get (0) | 2013.04.22 |
[jQuery] 6. jQuery method chaining (0) | 2013.04.22 |
[jQuery] 5. jQuery 이펙트 (0) | 2013.04.22 |
[jQuery] 4. jQuery이벤트 (0) | 2013.04.22 |
[jQuery] 3. jQuery 셀렉터 (0) | 2013.04.16 |
[jQuery] 2. jQuery 문법 (0) | 2013.04.11 |