使用JSFiddle时,从javascript控制台调用jQuery [英] Call jQuery from javascript console when using JSFiddle

查看:875
本文介绍了使用JSFiddle时,从javascript控制台调用jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的调试和创建过程中,通常会从javascript控制台(firefox或chrome内置的firebug)中触发一些jQuery命令,仅用于检查和测试。我注意到,我无法与JSFiddle使用jQuery()调用的页面中的任何元素交互,并且$()不正常的行为(我猜到它绑定到mootools或X其他框架?)查看页面上使用的脚本列表告诉我jQuery库已加载。

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.

有关如何调用简单的jQuery(body)的任何想法。toggle(slow);从firebug或chrome javascript控制台?任何简单的方法来找出jQuery的绑定?

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?

不是必要的,但这里是一个jsfiddle使用jQuery为您的测试目的。 http://jsfiddle.net/HHecw/

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

谢谢!

推荐答案

您直接在jsFiddle框架中使用控制台。

jsFiddle使用MooTools ,而不是jQuery。

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

要从控制台与您的页面进行交互,您需要直接从 http://fiddle.jshell.net/HHecw/show/light/

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

这篇关于使用JSFiddle时,从javascript控制台调用jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆