View

JQUERY) 사용 방법

Melody:) 2021. 7. 9. 19:53

JQUERY 사용방법

방법 1. 다운로드

https://jquery.com/download/

 

Download jQuery | jQuery

link Downloading jQuery Compressed and uncompressed copies of jQuery files are available. The uncompressed file is best used during development or debugging; the compressed file saves bandwidth and improves performance in production. You can also download

jquery.com

 

방법 2. CDN  사용

링크 복사

script태그에 소스 삽입

자바스크립트 코드를 간소화

검색 Keywork : jquery css

$('    ') : $사용 하여 ()안에 태그를 삽입하여, 모든 ()안의  태그를 다루겠다는 의미.

	var Links = {
		setColor:function (color) {
		
//			var alist = document.querySelectorAll('a');
//			var i = 0;
//			while (i < alist.length) {
//			    console.log(alist[i]);
//			    alist[i].style.color = color;
//			    i = i + 1;
//			}
			$('a').css('color', color); // 후
			//모든 a태그의 color값을 color로 한다. 위 반복문을 한줄로 표시가능.
		}
		
	}
	var Body = {
		setColor:function(color) {
//			document.querySelector('body').style.color = color; // 전
			$('body').css('color',color); // 후
		},
		setBackgroundColor:function (color) {
//			document.querySelector('body').style.backgroundColor = color; // 전
			$('body').css('backgroundColor', color); // 후
		}
	}

 

 

'JAVASCRIPT' 카테고리의 다른 글

JAVASCRIPT) 시작  (0) 2021.07.09
JAVASCRIPT) UI VS API  (0) 2021.07.09
JQUERY) libraryVS framework  (0) 2021.07.09
Javascript) File  (0) 2021.07.09
JAVASCRIPT) 객체  (0) 2021.07.09
Share Link
reply
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31