수

제이쿼리 all selector

· 2017-08-03 (목) 10:35:21 · 2469

제이쿼리 all selector


설명 : 모든 요소를 ​​선택합니다.


주의 : 모든 또는 유니버설 선택기는 단독으로 사용할 때를 제외하고는 매우 느립니다.

예 :

문서의 모든 요소 (머리, 몸체 등 포함)를 찾습니다. 브라우저 에 DOM에 a <script>또는 <link>요소를 삽입하는 확장 기능 / 추가 기능이 활성화되어 있으면 해당 요소도 함께 계산됩니다.



<!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>

댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,404건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
jQuery 17-08-15 조회 1,941
jQuery 17-08-11 조회 1,858
jQuery 17-08-11 조회 2,737
jQuery 17-08-11 조회 2,214
PHP 17-08-10 조회 4,254
jQuery 17-08-10 조회 2,118
jQuery 17-08-10 조회 2,432
jQuery 17-08-10 조회 2,250
jQuery 17-08-09 조회 2,011
jQuery 17-08-09 조회 2,694
jQuery 17-08-09 조회 2,219
jQuery 17-08-08 조회 2,553
jQuery 17-08-08 조회 2,314
jQuery 17-08-08 조회 2,546
jQuery 17-08-07 조회 2,222
jQuery 17-08-07 조회 2,039
jQuery 17-08-07 조회 1,854
jQuery 17-08-06 조회 2,249
jQuery 17-08-06 조회 2,893
jQuery 17-08-06 조회 1,903
jQuery 17-08-04 조회 2,302
jQuery 17-08-04 조회 2,280
jQuery 17-08-04 조회 3,119
jQuery 17-08-03 조회 2,604
jQuery 17-08-03 조회 2,470
jQuery 17-08-03 조회 2,473
jQuery 17-08-02 조회 2,226
jQuery 17-08-02 조회 1,615
jQuery 17-08-02 조회 2,328
jQuery 17-08-01 조회 3,052