Results 1 to 3 of 3

Thread: Find out what function has been invoked

  1. #1
    Join Date
    Sep 2010

    Exclamation Find out what function has been invoked

    Quick question. (I tried to use firebug but have no idea how to do it correctly)

    I have got some button at page. After click it triggers some function. How to exactly find out what is the name of this function and which library (file) loading it.

    need this to investigate some bug in 3rd party library

    Piotr Mąsior

  2. #2
    Join Date
    Dec 2003
    Bucharest, ROMANIA
    I guess that event (onclick) was added dynamically...

    It's quite an intricate job. To find which function is triggered onclick, you may do something like that: Make sure your button has an id, say id="myButton". It is not necessary, could be any other DOM way to refer that element, but for the following code (which is a basic example), you need that.

    <script type="text/javascript">
    function checktarget(e){
    var target = (e && e.target) || (event && event.srcElement);
    for(a in target){
    The base idea of the code is to find which element (target in my code) on the document was clicked, and if it is that button, to circle trough all his properties to find the event attached called onclick (match(/click/) in my code), therefor to alert the value of that event - target[a] in my code -which value is exactly the function you are looking for. Of course, if you are looking for another event, you should modify the code accordingly.

    But there is no way to find using a code where that function is. For that, I recommended you to use Firebug addon for FireFox as browser (use the Firebug's Search box)
    Last edited by Kor; 12-22-2010 at 09:09 AM.

  3. #3
    Join Date
    Sep 2010
    thank you, for your reply - good stuff


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center