본문 바로가기

개발하자/jQuery

클릭한 버튼 원하는 값으로 바꾸기

<html>
 <head>
 <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
 <script>

 $(document).ready(function(){

 $("input").click(function(){
  //this.value="홍길동";
 $(this).val("홍길동");    //인자값 주지 않으면 값을 얻어오는것이고 인자값 주면 셋팅하는 것이다.
 });

 });

 </script>
 </head>
 <body>
 <input type="button" value="aaa">
 <input type="button" value="bbb">
 <input type="button" value="ccc">
 </body>
</html>

'개발하자 > jQuery' 카테고리의 다른 글

원하는 태그의 css값 얻어오기  (0) 2015.02.27
원하는 태그에 css적용시키기  (0) 2015.02.27
원하는 버튼에 이벤트주기  (0) 2015.02.27
모드 버튼에 이벤트 주기  (0) 2015.02.27
blur  (0) 2015.02.23