To answer your question, try using the Firebug command line. This will allow you to use JavaScript to quickly capture an element by ID, and then repeat listening to it. Often, if used with console.log, you can even get function definitions.
Now, to protect unobtrusive:
The manual that I find in unobtrusive JavaScript is that it is much easier for me to see the DOM for what it is. However, I find that it is generally bad practice to create anonymous functions (with some exceptions). (The biggest mistake I find in jQuery is actually in their documentation. Anonymous functions can exist in the underworld, where a failure does not lead to a useful conclusion, but jQuery makes them standard.) Usually I only have a policy using anonymous functions if I need to use something like bindAsListener from Prototype.
In addition, if the JS files are properly split, they will access one subset of the DOM at a time. I have an "ordered checkbox" library, it is in only one JS file, which is then reused in other projects. I also usually have to use all the methods of this sub-library as member methods of both the JSON object and the class, and I have one object / class for the js file (just as if I were doing everything in a more formalized language) . If I have a question about my “form validation module”, I will look at the formValidation object in formvalidation.js.
At the same time, I agree that sometimes things can become dumb in this way, especially when working with others. But disorganized code is disorganized code, and it cannot be avoided if you are not working on your own and are not a good programmer.
In the end, I would prefer to use /* */ to comment on most of two or three js files, to find the wrong code, then go through the HTML and remove the onclick attributes.
cwallenpoole
source share