개요
- jQuery 클릭 이벤트
- jQuery .click()
예시1: input button
<script src="//code.jquery.com/jquery.min.js"></script>
<input type='button' id="button1" value='버튼1'/>
<script>
$("#button1").click(function() {
alert("버튼1을 누르셨습니다.");
});
</script>
예시2: button
<script src="//code.jquery.com/jquery.min.js"></script>
<button id="button1">버튼1</button>
<script>
$("#button1").click(function() {
alert("버튼1을 누르셨습니다.");
});
</script>
같이 보기
- jQuery 폼 내부 어느 버튼인지 확인
- jQuery CSS 속성 변경
- jQuery 이벤트
- jQuery preventDefault 함수
- jQuery bind 함수
- jQuery 모바일 시작하기
- JavaScript 클릭 이벤트