728x90
์ ์ด ์ฟผ๋ฆฌ jQuery -> ์๋ฐ์คํฌ๋ฆฝํธ์ ๊ฒฝ๋ํ ๋ฒ์
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
<!--
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> -->
<!-- <script src="./jquery/jquery.min.js"></script> ํด๋์ ์ ์ฅํ ์ฌ์ฉ๊ฐ๋ฅ .min ์
๋ ฅ ์ค์ -->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<!-- ์ ์ธ๊ฐ์ค์ ์๋ฌด๊ฑฐ๋ ์จ๋๋ฉ๋๋ค -->
</head>
<body>
<!--
Java Script : client(front)
ํ๋ฉด์ resource์ ์ค์ , ์ทจ๋ํ๋ ๋ถ๋ถ์ ์ฒ๋ฆฌ
DOM(getElementById, nodelist)
Spring Framework
Spring boot Vue, react
jQuery(์๋ฐ์คํฌ๋ฆฝํธ์ ๊ฒฝ๋ํ) -> ajax(๋น๋๊ธฐ ํต์ )
-->
<script type="text/javascript">
/*
ํ์:
$(ํ๊ทธ๋ช
, ๋๋ ID class ๋๋ name).ํธ๋ค๋ฌํจ์(๋งค๊ฐ๋ณ์)
getter, setter
getter -> let v = document.getElementById("id๊ฐ").value
setter -> document.getElementById("id๊ฐ").value="abc";
document.getElementById("id๊ฐ").innerHTML (์ผ๋ฐํ๊ทธ๋ innerHTML)
document.getElementById("id๊ฐ").value (์ธํ ์์ํํ๊ทธ๋ ๋ฐธ๋ฅ)
---------
์ ์ด์ฟผ๋ฆฌ๋?
์ผ๋ฐํ๊ทธ
html() = innerHTML
text()
formํ๊ทธ
val() = value
*/
</script>
<p>์ฌ๊ธฐ๊ฐ p tag์
๋๋ค</p>
<script type="text/javascript">
$(document).ready(function () {
/* let ptag = $("p").html(); // getter, pํ๊ทธ๋ฅผ ์ ๊ทผํ๊ฒ ๋ค. html์ด๋ผ๋ ์ฝ๋ ๊ฐ๊ณ ์ค๊ฒ ๋ค.
//alert(ptag);
$("p").html("hello <b>p</b> tag"); //setter ๋งค๊ฐ๋ณ์๋ฅผ ๋ฃ๋๊ฒ */
let ptag = $("p").text();
//alert(ptag);
//$("p").text("hello <b>p</b> tag"); //text ๋ ํ๊ทธ๋ฅผ ์๋์ํค์ง์๊ณ ๋ฌธ์์ด๋ก ์ธ์
});
</script>
<p id="demo">p tag id demo</p>
<h3 class="cls">h3 tag class cls</h3>
<p class="cls">p tag class cls</p>
<script type="text/javascript">
$(document).ready(function() {
/* let demo = $("#demo").html(); //== text()
//alert(demo);
$("#demo").text("hello p tag demo");
//class ๋ถ๋ถ
$(".cls").text("class cls set"); */
//ํน์ ํ๊ทธ์ ๋ด์ฉ์ ๋ชจ๋ ๋ฐ๊พธ๋๋ฒ
/* //javascript ๋ฌธ๋ฒ
let arrptag = document.getElementsByTagName("p");
for(i=0;i<arrPtag.length; i++){
arrPtag[i].innerHTML = "์ด๊ฒ์ p ํ๊ทธ์
๋๋ค";
} */
//jquery ๋ฌธ๋ฒ
$("p").html("์ด๊ฒ์ p ํ๊ทธ์
๋๋ค. jquery");
$("p.cls").text("class cls set");
//pํ๊ทธ 30๊ฐ์ค 15๊ฐ๋ง ๋ฐ๊พผ๋ค๊ณ ํ์๋ class๋ก ๋ฌถ์ด์ ์ ์ฉ์ํฌ ์ ์๋ค.
});
</script>
</body>
</html>
'๐ ์๋ฐ ์๋ฒ ํ์ด์ง JSP > ๐ช ์ ์ด ์ฟผ๋ฆฌ jQuery' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
์ ์ด ์ฟผ๋ฆฌ - ์ด๊ธ ๋ฌธ์ /ํ์ด 1๏ธโฃ๐ (0) | 2021.03.08 |
---|---|
5๏ธโฃ ์ ์ด ์ฟผ๋ฆฌ - List , Option + Oppend, Prepend ์ ์ฉ (0) | 2021.03.05 |
4๏ธโฃ ์ ์ด ์ฟผ๋ฆฌ - ๋ฒํผ + 2์ฐจ์ ๋ฐฐ์ด ์ด์ฉํ ํ ์ด๋ธ ์๋ ์์ฑ (0) | 2021.03.05 |
3๏ธโฃ ์ ์ด ์ฟผ๋ฆฌ - CSS, MouseOver, ์์ฑ ์ถ๊ฐ (0) | 2021.03.05 |
2๏ธโฃ ์ ์ด ์ฟผ๋ฆฌ - Button ํ๊ทธ ์ ๊ทผ๊ณผ ์๋๋ฒ, + this (0) | 2021.03.05 |
๋๊ธ