수

제이쿼리 all selector

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

제이쿼리 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,814
jQuery 17-08-11 조회 2,701
jQuery 17-08-11 조회 2,186
PHP 17-08-10 조회 4,227
jQuery 17-08-10 조회 2,087
jQuery 17-08-10 조회 2,380
jQuery 17-08-10 조회 2,221
jQuery 17-08-09 조회 1,983
jQuery 17-08-09 조회 2,668
jQuery 17-08-09 조회 2,194
jQuery 17-08-08 조회 2,525
jQuery 17-08-08 조회 2,277
jQuery 17-08-08 조회 2,517
jQuery 17-08-07 조회 2,197
jQuery 17-08-07 조회 2,007
jQuery 17-08-07 조회 1,816
jQuery 17-08-06 조회 2,222
jQuery 17-08-06 조회 2,868
jQuery 17-08-06 조회 1,882
jQuery 17-08-04 조회 2,275
jQuery 17-08-04 조회 2,252
jQuery 17-08-04 조회 3,093
jQuery 17-08-03 조회 2,570
jQuery 17-08-03 조회 2,444
jQuery 17-08-03 조회 2,442
jQuery 17-08-02 조회 2,200
jQuery 17-08-02 조회 1,579
jQuery 17-08-02 조회 2,277
jQuery 17-08-01 조회 3,008
jQuery 17-08-01 조회 2,907