반응형
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script>
      //removeAttr
      // 선택된 엘리먼트(요소)에서 하나 이상의 속성을 제거
      // $(selector).removeAttr(attribute)
      // $('p').removeAttr('style');
      $(document).ready(function() {
        $("button").click(function() {
          $("p").removeAttr("style");
        });
      });
    </script>
    <title>Document</title>
  </head>
  <body>
    <p style="font-size:120%; color:red">This is a paragraph.</p>
    <p style="font-weight:bold; color:blue">This is another paragraph.</p>

    <button>Remove the style attribute from all p elements</button>
  </body>
</html>
반응형

'2020 > JQuery' 카테고리의 다른 글

JQuery odd, even 위치 필터선택자  (0) 2020.03.03
JQuery clone(), 문서 객체 복제  (0) 2020.03.03
JQuery 특정 태그 선택 find()  (0) 2020.03.03
JQuery is()  (0) 2020.03.02
jquery 문서 객체 추가 선택(add)  (0) 2020.03.02
블로그 이미지

꽃꽂이하는개발자

,