Tôi muốn biết phần tử nào được nhấp để tôi có thể thay đổi lớp CSS của nó. Đây là mã:Lấy phần tử được nhấp vào trong ButtonSet
<script type="text/javascript">
$(function() {
$("#radio").buttonset();
});
</script>
<div id="radio">
<input type="radio" id="radio1" name="radio" /><label for="radio1">Choice 1</label>
<input type="radio" id="radio2" name="radio" checked="checked" /><label for="radio2">Choice 2</label>
<input type="radio" id="radio3" name="radio" /><label for="radio3">Choice 3</label>
</div>
gì phần này có nghĩa là: 'var $ element = $ (this); '? '$ Element' khác nhau như thế nào? Bạn sẽ làm gì với điều đó? –
@jeffamaphone 'this' là nút DOM. '$ (this)' là đối tượng jQuery chứa nút DOM – BrunoLM