#4969 closed enhancement (fixed)
Using Jquery .live() insteed .click()
Reported by: | megainfo | Owned by: | |
---|---|---|---|
Milestone: | 1.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Templates | Keywords: | |
Cc: |
Description
I suggest using jquery .live() function instead .click() in all javascript events.
.click() is not applied if the content is recovered from ajax response ( for example, if you click 'add friend' then ajax answer is an html input button 'Cancel Friendship Reques' , the .click() event is not applied to this new button).
Attachments (2)
Change History (10)
#7
@
11 years ago
- Keywords reporter-feedback removed
- Milestone changed from Awaiting Review to 1.8
- Resolution set to fixed
- Status changed from new to closed
So far as I can tell, the other instances you mention (1013, 1058) are for buttons/links that are never added by AJAX to the page, at least not in the context of bp-legacy. I don't think we need to go to the trouble of doing true event delegation for those items, as it would require changing some of the logic of the JS. For this reason, I'm going to mark this ticket as fixed. If you find more instances where we *need* to use delegation, please feel free to reopen this ticket with details, or open a new ticket. Thanks!
.live()
is deprecated. We should be using.on()
with proper event delegation.If you find specific places in our JS where we're using
.click()
and need the delegation, please post them here.