두 개의 html 버튼 요소가 있습니다.jquery로 두 개의 html selector를 결합 할 수 있습니까?
<input type="button" class="button-a" value="Button a"/>
<input type="button" class="button-b" value="Button b"/>
그래서 아무 버튼이나 클릭하면 같은 이벤트가 발생합니다. 그래서 나는 jquery 코드를 작성함으로써 그렇게 할 수있다.
<script>
$(document).ready(function() {
//button-a click event
$('.button-a').click(function(){
alert("The event triggered");
});
//button-b click event
$('.button-b').click(function(){
alert("The event triggered");
});
});
</script>
event()
을 OR 조건과 함께 jQuery와 결합 할 수 있습니까?
쉼표로 구분, $ ('. button-a, .button-b') – abhijit