https://cdnjs.com/libraries/jquery
jquery - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers
JavaScript library for DOM operations - Simple. Fast. Reliable. Content delivery at its finest. cdnjs is a free and open-source CDN service trusted by over 12.5% of all websites, serving over 200 billion requests each month, powered by Cloudflare. We make
cdnjs.com
여기서 주소 복사 후 주소창에 검색해서 다른이름으로 원하는 폴더 안에 저장한다.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
#my-div{
width: 100px;
height: 100px;
background-color: aqua;
}
</style>
<!-- 받은 jquery 파일 불러오기 -->
<script src="./js/jquery.min.js"></script>
<script>
// 색상을 빨강으로 변경
function func() {
$("#my-div").css("backgroundColor", "red");
}
</script>
</head>
<body>
<div id="my-div">
</div>
<button onclick="func()">클릭하기</button>
</body>
</html>
스크립트로 받은 jquery 파일을 불러온다. 다음과 같이 jquery를 이용해 css를 건드려 div의 색상을 빨강으로 변경할 수 있다.
<!-- 받은 jquery 파일 불러오기 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
만약 위 방법이 번거롭다면, 그냥 저 사이트에 있는 주소 그대로 복사 붙여넣기 해도 된다.
'JQuery' 카테고리의 다른 글
| [JQuery] val메서드, getter, setter (0) | 2024.11.18 |
|---|---|
| [JQuery] ready 함수 (0) | 2024.11.13 |
| [JQuery] prev, prevAll, next, nextAll, siblings, even, odd (0) | 2024.11.11 |
| [JQuery] $ 메서드와 css 메서드 선택자 (0) | 2024.11.08 |