«   2024/09   »
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
Archives
Today
Total
09-22 04:37
관리 메뉴

DevTzu

[Selector] ID Selector $('#id') 본문

study

[Selector] ID Selector $('#id')

DevTzu 2011. 9. 10. 18:36
반응형

id 선택자



선택자 : ID
CSS : #some-id
jQuery : $('#some-id')
설명 : 도큐먼트 내에서 some-id라는 ID를 가지는 단일 요소를 가져온다.



<!DOCTYPE html>
<html>
<head>
  <style>
  div {
    width: 90px;
    height: 90px;
    float:left;
    padding: 5px;
    margin: 5px;
    background-color: #EEEEEE;
  }
  </style>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
  <div id="notMe"><p>id="notMe"</p></div>

  <div id="myDiv">id="myDiv"</div>
<script>$("#myDiv").css("border","3px solid red");</script>

</body>
</html>



반응형
Comments