I have a button, when clicked this button invokes a function that changes the buttons html, and it's click. The problem is it somehow maintains the old trigger code. Before I put the click functions in their own functions (rather than just adding function(){} to the parameter) it would gain code every click, so if you clicked the button 4 times the code would execute both trigger functions 4 times, then if you clicked it a fifth time it would do both functions 5 times.
I can't think of any way to resolves this besides reverting to javascript code, and even then I'm not sure if it will work. I looked at the jquery source, but couldn't figure out what the triggers code was doing. (To me it looked like it was defining a bunch of function that took in functions, but with no connection to the javascript triggers >>) Anyways this is my code: -- $(function() { $("#cButton").click(closeButton); }); function closeButton() { alert('close hit'); $("#cButton") .html("Cancel") .click(cancelButton); } function cancelButton() { alert('cancel hit'); $("#cButton") .html("Close") .click(closeButton); } -- When you hit the button the first time it gives the 'close hit' alert, but if you hit it a second time it will give the 'close hit' alert first, then give the 'cancel hit' alert. Any idea?