Call jQuery from javascript console when using JSFiddle

耗尽温柔 提交于 2020-01-12 09:08:33

问题


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/



来源:https://stackoverflow.com/questions/8387661/call-jquery-from-javascript-console-when-using-jsfiddle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!