Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass the element that triggered Pjax to the pjax:send event #94

Merged
merged 1 commit into from
Dec 21, 2017

Conversation

BehindTheMath
Copy link
Collaborator

Closes #62.

With this PR, you can access the element that triggered the pjax:send event with event.triggerElement.

@BehindTheMath BehindTheMath requested a review from MoOx December 21, 2017 05:19
@BehindTheMath BehindTheMath merged commit d3d5ef7 into master Dec 21, 2017
@BehindTheMath BehindTheMath deleted the enhancement/pass-element-triggered branch December 21, 2017 18:06
@ldrummond
Copy link

Fair warning if you end up here - be careful listening to pjax events with Jquery "on". It appears to overwrite the custom pjax event and leaves triggerElement undefined. Probably should be pretty obvious but it took me a while to figure out.

$(document).on("pjax:send", function(e) { console.log(e.triggerElement) // undefined })

Is this worth mentioning in the docs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accessing the anchor that was clicked before pjax:send
3 participants