ㅁ $(this).hide() - 현재 HTML 요소를 숨김
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $(this).hide(); }); }); </script> </head> <body> <h2>This is a heading</h2> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <button>Click me</button> </body> </html> | cs |
결과 : 버튼이 삭제 된다.
ㅁ $("p.intro").hide - p태그의 intro 클래스의 요소 숨김
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("p.intro").hide(); }); }); </script> </head> <body> <h2>This is a heading</h2> <p class="intro">This is a paragraph.</p> <p>This is another paragraph.</p> <button>Click me</button> </body> </html> | cs |
결과 : This is a paragraph 삭제
ㅁ $("p:first") - p태그 첫 번째 요소 숨김
ㅁ $("[href]").hide - href 속성 요소 숨김
'문돌이의 IT > jQuery' 카테고리의 다른 글
jQuery Effects 제이쿼리 효과 - hide and show (0) | 2017.08.08 |
---|---|
jQuery event 제이쿼리 이벤트 (2) (0) | 2017.08.07 |
jQuery event 제이쿼리 이벤트 (1) (0) | 2017.08.06 |
jQuery 셀렉터 (Selector) (3) | 2017.07.26 |
jQuery 기초 및 특징 (0) | 2017.07.25 |