Side navigation
#13737 closed bug (notabug)
Opened April 05, 2013 03:01PM UTC
Closed April 05, 2013 06:04PM UTC
.on triggered only once.
Reported by: | lolka_bolka | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Documentation says:
''A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
''
I am having a link, and when i click on that, the content of the parent div is changed by ajax.
If i am using this:
$('.calendar_next_month, .calendar_prev_month').on('click', function(e) {
then it loads the content. the content came from a function, so the loaded content include the links with the specified selector.
after that, when i clicked on the link, the .on not triggered.
if i am using on this way:
$(document).on('click', '.calendar_next_month, .calendar_prev_month', function(e) {
it works.
I think, this is bug, because the documentation says, "the selected elements that triggered". In the first case, the triggered element has no descendant, so it shouldn't trigger the .on, bacause it will never reach the selected element, because selected element is the element that triggered.
Summarize: in the first case, it shouldn't work, but works.
Attachments (0)
Change History (1)
Changed April 05, 2013 06:04PM UTC by comment:1
resolution: | → notabug |
---|---|
status: | new → closed |
You most likely change contents of the parent div so those children no longer exist. Please ask for support on forums, this is not a bug.