반응형
<!DOCTYPE html>
<html>
  <head>
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
  </head>
  <body>
    <button>버튼1</button>
    <button>버튼 2</button>

    <div><span>0</span> button #1 clicks.</div>
    <div><span>0</span> button #2 clicks.</div>

    <script>
      $("button:first").click(function() {
        add($("span:first"));
      });
      $("button:last").click(function() {
        $("button:first").trigger("click");
        add($("span:last"));
      });

      function add(plus) {
        var n = parseInt(plus.text(), 10);
        plus.text(n + 1);
      }
    </script>
  </body>
</html>
반응형
블로그 이미지

꽃꽂이하는개발자

,