When I use this code with an element whose id is "foobar":
$("#foobar").click(function () { alert("first"); });
$("#foobar").click(function () { alert("second"); });
I get two warnings: "first" and "second" second.
How to specify a click event that also clears any previous click events associated with an element? I want the latter to $("#foobar").click(...)delete any previously related events.
source
share