수

제이쿼리 all selector

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

제이쿼리 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,839
jQuery 17-08-11 조회 2,718
jQuery 17-08-11 조회 2,200
PHP 17-08-10 조회 4,239
jQuery 17-08-10 조회 2,103
jQuery 17-08-10 조회 2,396
jQuery 17-08-10 조회 2,236
jQuery 17-08-09 조회 1,998
jQuery 17-08-09 조회 2,680
jQuery 17-08-09 조회 2,206
jQuery 17-08-08 조회 2,535
jQuery 17-08-08 조회 2,295
jQuery 17-08-08 조회 2,530
jQuery 17-08-07 조회 2,209
jQuery 17-08-07 조회 2,025
jQuery 17-08-07 조회 1,836
jQuery 17-08-06 조회 2,235
jQuery 17-08-06 조회 2,882
jQuery 17-08-06 조회 1,892
jQuery 17-08-04 조회 2,289
jQuery 17-08-04 조회 2,268
jQuery 17-08-04 조회 3,107
jQuery 17-08-03 조회 2,587
jQuery 17-08-03 조회 2,455
jQuery 17-08-03 조회 2,459
jQuery 17-08-02 조회 2,215
jQuery 17-08-02 조회 1,601
jQuery 17-08-02 조회 2,292
jQuery 17-08-01 조회 3,040
jQuery 17-08-01 조회 2,921