3초기억력

jquery - detach() : 줄 삭제(버퍼에 남음?) 본문

코딩_jquery

jquery - detach() : 줄 삭제(버퍼에 남음?)

잠수콩 2011. 3. 25. 13:27
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
<!DOCTYPE html>
<html>
<head>
 <meta http-equiv="content-type" content="text/html; charset=utf-8">
 <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
  <button id="T">Click</button>
  <button id="B">AClick</button>
  <div class="container">
    <div class="hello">Hello</div>
    <div class="goodbye">Goodbye</div>
  </div>

  <script>
    $(document).ready(function() {

        $('#T').click(function () {
          //$('.hello').remove();
          //$('div').remove('.hello');  // 위의 소스와 동일한 소스
          $('div').detach('.hello');
        });

    });


  </script>
</body>
</html>
Comments