button onclick or on dom change code example Example: javascript change button onclick function Bar() { document.getElementById("a").onclick = Foo(); }