📅  最后修改于: 2022-03-11 15:01:17.695000             🧑  作者: Mango
function bindButtons(){
var buttons = $('#buttons button');
buttons.on('click', function(e){
var $this = $(this);
buttons.removeClass('selected').addClass('disabled');
$this.addClass('selected').removeClass('disabled');
switch ($this.attr('id')){
case 'yes':
val = true;
break;
case 'no':
val = false;
break;
}
//do something with val
})
}