Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to change the backgroung of one button when click the other one

 var buttons = document.querySelectorAll("button");
 
 for (button in buttons) {
    buttons[button].onclick = function() {
        console.log('test')
        buttons.forEach(function(btn){
          btn.classList.remove('highlight');
        })
        this.classList.add('highlight');
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: omise library 
Javascript :: add multiple parameters js 
Javascript :: https - node load testing- 
Javascript :: what is react headroom 
Javascript :: check if string is json parsable 
Javascript :: javascript set content in div without innerhtml 
Javascript :: non-arrow functions are forbidden $(document).ready(function() { 
Javascript :: Audio Stream from Server through Scoket 
Javascript :: pdf extract text nodejs 
Javascript :: Mapping an Array to Elements with v-for 
Javascript :: Array-multiple test case 
Javascript :: javascript return strung 
Javascript :: extending classes javascript 
Javascript :: aos cdn 
Javascript :: disable click extra collapse antd 
Javascript :: Caused by: PG::ConnectionBad: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"? postgres app 
Javascript :: javascript filter in place algorithm 
Javascript :: express.js 
Javascript :: md5 online decrypt 
Javascript :: know if a gridview is empty from javascript 
Javascript :: add attribute jquery 
Javascript :: EventEmitter to emit a custom event 
Javascript :: curl --post with api 
Javascript :: js The equivalent of destructuring arrays and objects 
Javascript :: react native debug server host & port for device 
Javascript :: How to Compare Strings Using Mathematical Operators 
Javascript :: how to generate a random number between 1 and 6 in javascript 
Javascript :: Create a new object where the prototype is {0:10} 
Javascript :: _.isEqual Underscore Example 
Javascript :: how to cut and paste an element in vanilla javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =