Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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
  })
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: what is the difference between angular changedetection default and onpush stratergy 
Javascript :: valueof in react native 
Javascript :: connect react native app to local api macos 
Javascript :: 300000/12 
Javascript :: PlayerInteractEntityEvent get called twice 
Javascript :: let scores = [80, 90, 70]; for (const score of scores) { console.log(score); } 
Javascript :: js stringConstructor type 
Javascript :: javascript runne 
Javascript :: how to draw square to the center in canvas 
Javascript :: how to store textbox data while typing for chrome extension 
Javascript :: how to creat puzzle 15 at jq 
Javascript :: start to work with a pre existing react projects 
Javascript :: can i use hooks with expo in react native 
Javascript :: node close rabbitmq connection 
Javascript :: backbone js event listener 
Javascript :: likert scale javascript code 
Javascript :: how to write a program that determines the minutes since midnight, Jan 1, 1970 in javascript 
Javascript :: what is the modern syntax for iterating through array using for loop in javascript 
Javascript :: puppeteer sign in to popup facebook 
Javascript :: event listener function called parameters 
Javascript :: angular http call caching issue even after no-cache 
Javascript :: how to copy from js the lines of an html 
Javascript :: tableau js api 
Javascript :: inmutabilidad javascript 
Javascript :: .env file vars nto defined in child directory 
Javascript :: in object transform translate property concat with rotate value angular 7 
Javascript :: based on scroll position and get data attribute javascript 
Javascript :: how to create alias in populate moongoose + nodejs 
Javascript :: js var 
Javascript :: juqey unbind click 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =