Answers for "javascipt toggle two buttons"

0

javascipt toggle two buttons

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
  })
}
Posted by: Guest on November-06-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language