showing results for - "javascipt toggle two buttons"
Josefa
05 Mar 2017
1function bindButtons(){
2  var buttons = $('#buttons button');
3
4  buttons.on('click', function(e){
5    var $this = $(this);
6    buttons.removeClass('selected').addClass('disabled');
7    $this.addClass('selected').removeClass('disabled');
8
9    switch ($this.attr('id')){
10        case 'yes': 
11            val = true;
12            break;
13        case 'no': 
14            val = false;
15            break;
16    }
17    //do something with val
18  })
19}
20