Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to make a button jump between two functions when clicked in javascript

function buttonClick() {
    //do stuff
    this.onclick = notButtonClick; //function reference to nBC
}

function notButtonClick() {
    //do more stuff
    this.onclick = buttonClick; //function reference to original function
}

var el = document.getElementById("numberonebutton"); //let for ES6 aficionados 
el.onclick = buttonClick; //again, function reference, no ()
Comment

PREVIOUS NEXT
Code Example
Javascript :: creating large element in js 
Javascript :: função que retorna uma media aritmética javascript 
Javascript :: angular stepper change wait before changing 
Javascript :: get top items from json object 
Javascript :: Regular Expressions: Find More Than the First Match 
Javascript :: universal apollo kit 
Javascript :: how to transpose json data 
Javascript :: adding a variable to a string without using + in javascript 
Javascript :: mvc form client side validation result callback 
Javascript :: Target type ieee.std_logic_1164.STD_LOGIC_VECTOR in variable assignment is different from expression type ieee.std_logic_1164.STD_ULOGIC. 
Javascript :: angular specific attributes and locators list 
Javascript :: warning Non-interactive elements should not be assigned mouse or keyboard event listeners jsx-a11y/no-noninteractive-element-interactions 
Javascript :: javascript substring messes emoji 
Javascript :: infinite scrolling firestore vuejs 
Javascript :: inmutabilidad javascript 
Javascript :: map.getIn gives whole data if prop missing in js 
Javascript :: console log update status bar 
Javascript :: node-emoji list 
Javascript :: what is amqp10 policy nodejs 
Javascript :: inferred type is Array<out GroupItem 
Javascript :: concept of node js with react js 
Javascript :: spreading object as props 
Javascript :: querySelector a slot vuejs 
Javascript :: how to get the video time every second after 
Javascript :: generator in classs js 
Javascript :: Ocultar o mostrar elementos html con js 
Javascript :: trigger click on each element of class 
Javascript :: extend static class javascript 
Javascript :: angular cli generate component no tests 
Javascript :: Nodejs - non-flowing data stream 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =