Ticket #3964 (closed bug: invalid)
Multiple click events fire on a single click
| Reported by: | alekdavis | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.3.2 |
| Component: | unfiled | Version: | 1.3.1 |
| Keywords: | click bind event postback UpdatePanel ASP.NET | Cc: | alek.davis@… |
| Blocking: | Blocked by: |
Description
I'm not sure if this is a jQuery issue or an ASP.NET AJAX issue. I have the following code:
$('input:image[id$=\'itemID\']').click( function() {
return confirm("Confirmation message.");
});
ItemID is ID of IMG element in an UpdatePanel control of a Repeater control (ASP.NET 3.5, Visual Studio 2008). This function works fine when the the page is loaded, but after each partial postback (of any UpdatePanel in the Repeater), clicking the IMG element causes multiple events (several confirmation dialogs pop up). I modified the event handler to call unbind and then bind for the click event, but doing so resulted in the event not been called (no confirmation dialogs) until the first partial postback (after the first partial postback it worked fine, though).
I ended up setting the onclick event for the IMG element (<IMG onclick="" .../>), which solved the problem, but I'm suspecting that there may be an issue with jQuery. I can send a sample project if needed.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Forgot to mention: the same behavior is in Firefox 3 and IE 7.