Call jQuery from javascript console when using JSF

2019-03-30 16:10发布

问题:

It's typical in my debug and creation process to fire off a few jQuery commands from the javascript console (firebug in firefox or chrome's built-in) just for inspection and testing purposes. I've noticed that I'm unable to interact with any elements in the page on JSFiddle using the jQuery() call, and that $() doesn't behave normally either (I'm guessing it's bound to mootools or X other framework?) Looking at the list of scripts used on the page tells me that the jQuery library is loaded.

Any ideas on how I can call something as simple as jQuery("body").toggle("slow"); from the firebug or chrome javascript console? Any simple way to find out jQuery's binding?

not that it's necessary, but here is a jsfiddle using jQuery for your testing purposes. http://jsfiddle.net/HHecw/

Thanks!

回答1:

You're using the console directly in the jsFiddle frame.
jsFiddle uses MooTools, not jQuery.

To interact with your page from the console, you need to open the "result" frame directly, from http://fiddle.jshell.net/HHecw/show/light/