Accessing the anchor that was clicked before pjax:send #62
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi - wonder if anyone could help me, I need to somehow access the anchor that was actually clicked to trigger the pjax:send event. I figured I could do this by listening for the click on any but this event happens after the pjax:send. Any ideas?
@howells I trigger pjax call directly.
Note that pjax has to be a singleton, or it may break history (I haven't tested it, but from code inspection it seems that pjax was designed to only be instantiated once). The simplest way to do this is to instantiate pjax with a no-match selector.
Huh that's an interesting approach yeah - thanks. Right now I overrode
Pjax.prototype.attachLinkwith the same function, but prepended it with various stuff that I needed to do, which isn't really sustainable!With #94, you can access the element that triggered the
pjax:sendevent withevent.triggerElement.