[英]jquery: how do i know if i have it?
i need jquery to work on a browser locally. 我需要jquery在本地浏览器上工作。 how do i know if it is installed and how do i install it ?
我如何知道它是否已安装以及如何安装?
my question is specific to being able to run this code: 我的问题是特定于能够运行此代码:
onmouseover="evt.target.setAttribute('opacity', '0.5'); $('#someDiv').show();"
onmouseout="evt.target.setAttribute('opacity', '1'); $('#someDiv').hide();"
You can test if jQuery is loaded by opening your javascript console (in Chrome: Settings > More tools > Javascript console). 您可以通过打开javascript控制台来测试是否加载了jQuery(在Chrome中:设置>更多工具> Javascript控制台)。
Where the little blue arrow appears type: 小蓝色箭头出现的位置:
if(jQuery) alert('jQuery is loaded');
Press enter. 按enter键。
jQuery没有像程序一样安装,它是一个需要以某种方式包含在你的源代码中的文件,最常见的做法是通过添加<script type='text/javascript' language='javascript' src='local/path/to/jquery.js'></script>
页面的<head>
部分中的<script type='text/javascript' language='javascript' src='local/path/to/jquery.js'></script>
。
put this right above your closing body
tag: 把它放在你的结束
body
标记上方:
<script src="//ajax.googleapis.com/ajax/libs/jquery/[jquery version here]/jquery.min.js"
language="javascript" type="text/javascript"></script>
jquery isn't "installed" into a browser. jquery没有“安装”到浏览器中。 it's a js library referenced from the web page you are viewing.
它是您正在查看的网页引用的js库。
EDIT: This works if you have internet access. 编辑:这有用,如果你有互联网访问。 If not, you will have to download that file to your local system and reference the local path.
如果没有,则必须将该文件下载到本地系统并引用本地路径。
如果您打算在本地包含jQuery,根据Robert的建议,您首先必须从这里下载它: http : //code.jquery.com/jquery-1.4.2.min.js
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.