제이쿼리 all selector

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

제이쿼리 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,403건

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

+
분류 제목 글쓴이 날짜 조회
jQuery 17-08-11 조회 1,807
jQuery 17-08-11 조회 2,696
jQuery 17-08-11 조회 2,180
PHP 17-08-10 조회 4,220
jQuery 17-08-10 조회 2,075
jQuery 17-08-10 조회 2,362
jQuery 17-08-10 조회 2,214
jQuery 17-08-09 조회 1,962
jQuery 17-08-09 조회 2,657
jQuery 17-08-09 조회 2,182
jQuery 17-08-08 조회 2,505
jQuery 17-08-08 조회 2,254
jQuery 17-08-08 조회 2,506
jQuery 17-08-07 조회 2,186
jQuery 17-08-07 조회 2,000
jQuery 17-08-07 조회 1,806
jQuery 17-08-06 조회 2,208
jQuery 17-08-06 조회 2,843
jQuery 17-08-06 조회 1,868
jQuery 17-08-04 조회 2,265
jQuery 17-08-04 조회 2,237
jQuery 17-08-04 조회 3,083
jQuery 17-08-03 조회 2,548
jQuery 17-08-03 조회 2,433
jQuery 17-08-03 조회 2,425
jQuery 17-08-02 조회 2,176
jQuery 17-08-02 조회 1,557
jQuery 17-08-02 조회 2,246
jQuery 17-08-01 조회 2,982
jQuery 17-08-01 조회 2,879