📁Frontend/📓etc
[스파르타 코딩 클럽]Javascript
Hoon2
2022. 2. 28. 22:46
728x90
@2-1. 전역변수
<script>
let count = 1;
function hey() {
if (count % 2 == 0) {
alert('짝짝짝👏');
} else {
alert('홀홀홀🎅');
}
count += 1;
}
</script>
@2-2. JQuery
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
id = article-url >>> $('#article-url').(val, text) (); 지칭 / hide : 숨김 show : 보임
let temp_html = ` `(자주 씀) // 변수 넣기 : ${내용}
includes
: 구별 하기
let domain = txt.split('@')[1].split('.')[0]
: 나누기
$('#names-q3').empty()
empty : 다 지우기
@2-3. Ajax
$.ajax({
type: "GET",
url: "여기에URL을입력",
data: {},
success: function(response){
console.log(response)
}
})
--------------------------------------
jquery img src 변경 :
$("#img-cat").attr('src', imgurl)
.attr('src',imgurl)
728x90