The best place to ask programming/development questions, imo. UPDATE: stackoverflow is the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but a great reference for finding answers.

My Music (Nickleus)

20160411

jquery how to get this selector as string in event handler/listener

This won't show you the DOM path, but it will output a string representation of what you see in eg chrome debugger, when viewing an object.




    $('.mybtn').click( function(event){
    console.log("%s", this);   // output: "button.mybtn"
    });

https://developer.chrome.com/devtools/docs/console-api#consolelogobject-object

No comments:

Post a Comment