0

jQuery 1.11.2

Yes, I'm aware that it's been answered a couple of times before - but the provided replies doesn't work for me.

Using this page: https://www.lensway.se/cart

I need to check if any events have been added to the "Lägg till linser"-button. Button to get events for

I use the solution from here: jQuery 1.8 find event handlers

jQuery._data($('.add-row.LENS.btn.gray')[0], 'events')

But that returns undefined.

I know it has events, because I can see them in Chrome Dev Tools: Showing available events

The actual code that's executed to add the code looks like this:

 $(document).on("click", ".add-row", function(a) {

(I have no control over the code so I can't make modifications to it, I just need to detect if that code has been run and the element has the event)

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
jBoive
  • 1,219
  • 1
  • 14
  • 40

1 Answers1

0

Got it!

The event wasn't actually set on the object it was set on the document for some reason:

$(document).on("click", ".add-row", function(a) {

That's why the data object was empty (I was looking at the wrong element).

isherwood
  • 58,414
  • 16
  • 114
  • 157
jBoive
  • 1,219
  • 1
  • 14
  • 40