링크 · http://api.jquery.com/all-selector/
all selector
All Selector (“*”) - 모든 선택자 (“*”)
설명 : 모든 요소를 선택한다.
주의점: 직접적인 사용을 제외하고, 전체 또는 보편적으로 사용할 경우
성능이 매우 떨어집니다.
예제: 소스코드(html)에서 모든 요소(head, body 등 포함)를 찾습니다.
현 브라우저에서 DOM에 <script> 또는 <link> 형태로 확장, 추가 가능한 요소도 같이 포함하여 반환됩니다.
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 32 33 34 35 36 37 38 | <!doctype html> < html lang = "en" > < head > < meta charset = "utf-8" > < title >all demo</ title > < style > h3 { margin: 0; } div,span,p { width: 80px; height: 40px; float: left; padding: 10px; margin: 10px; background-color: #EEEEEE; } </ style > < script src = "https://code.jquery.com/jquery-1.10.2.js" ></ script > </ head > < body > < div >DIV</ div > < span >SPAN</ span > < p >P < button >Button</ button ></ p > < script > var elementCount = $("*").css("border", "3px solid red").length; $("body").prepend("< h3 >" + elementCount + " elements found</ h3 >"); // 코드 해설 현 문서의 모든 요소를 찾아 갯수를 구하고 빨간선으로 표시하여 보여 줍니다. </ script > </ body > </ html > |
'!' 카테고리의 다른 글
[jQuery]:Element Selector ("tag") (0) | 2018.04.15 |
---|---|
[jQuery]:Class Selector(".class name") (0) | 2018.04.15 |
[jQuery]:animated Selector (0) | 2018.04.01 |
Oracle 기초 2 (0) | 2015.11.23 |
Oracle 기초1 (0) | 2015.11.19 |