1

I am investigating some websites and really would like to know how they achieve some effects.

Sometimes the code is like this:

<a class="test" href="#">Test</a>

There is no function embedded directly but I'm quite sure there's something like:

$('a.test').click(function(){....});

But this could be hidden in its linked resources. So it's hard to find what's the tricks that I want.

Is there anyway to find, like a HTML element's all bind functions from Chrome JavaScript console?

AGamePlayer
  • 7,404
  • 19
  • 62
  • 119
  • You want click event should trigger automatically?? – ganesh satpute Dec 12 '15 at 12:25
  • No, he wants to discern what events are attached, which is famously tricky. jQuery does have a means to report on this, but you'll have a much harder time with events registered in native JS. – Mitya Dec 12 '15 at 12:26
  • 1
    Try to use [chrome developer tools](https://developer.chrome.com/devtools/docs/javascript-debugging#breakpoints-on-javascript-event-listeners) – Alexander Popov Dec 12 '15 at 12:32
  • Following @AlexanderPopov .. click to inspect an element then click on the 'Event Listeners' tab. Might not be that useful in the case of minified code. – Clay Dec 12 '15 at 12:34
  • sounds interesting but can't find anything readable... – AGamePlayer Dec 14 '15 at 07:30

1 Answers1

2

In the Chrome Developer tools, select an element to inspect on the page then click on the 'Event Listeners' tab. It may be useful to uncheck the 'Ancestors' checkbox too.

Clay
  • 4,700
  • 3
  • 33
  • 49