본문 바로가기

웹 프로그래밍/웹

[Web/Jquery] 기본 선택자

 

(요약노트와 비슷하므로, 기본적인 CSS3 개념은 아시고 와야할 겁니다!)

기본형태

------------------------------------------
            $('h1').css('color', 'orange');
------------------------------------------

 

1. 전체 선택자

$('*').css('color', 'orange');

 

2. 태그 선택자

$('h1').css('color', 'red');

 

3. 아이디 선택자

$('#wrap').css('background','#FFF');
$('div#wrap').css('background', '아귀찮다.');

 

4. 클래스 선택자

$('.item').css('font-family', '나눔고딕');
$('h1.item').css('font-fmaily', '에헷에헷');

 

5. 자손 선택자

$('body > *').css('color', '어떤색깔일까?');
$('ul >li').css('color', 'love'); //헤헷


6. 후손 선택자

$('body *').css('color', 'sky');

 

7. 속성 선택자

$('input[type="text"]').val('Hollo jQueury..!');

 

8. 필터 선택자

$('요소: 필터').css('background', 'sky');

 

대충 이정도로 정리할 수 있다.