js change onclick event after click code example Example: javascript change button onclick function Bar() { document.getElementById("a").onclick = Foo(); }