如何确定和打印jQuery版本? [英] How to determine and print jQuery version?

查看:122
本文介绍了如何确定和打印jQuery版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个jQuery函数返回当前加载的jQuery版本?

Is there a jQuery function that returns the version of jQuery that is currently loaded?

推荐答案

你可以使用这个:

$.fn.jquery
//or if you're using .noConflict():
jQuery.fn.jquery

在构建jQuery时自动更新,定义如下: http://github.com/jquery/jquery/blob/master/src/core.js #L174

It's updated automatically when jQuery is built, defined here: http://github.com/jquery/jquery/blob/master/src/core.js#L174

确保对不依赖的属性使用 $。fn.property 在一个对象上,没有理由使用 $()。property 创建一个不需要的jquery对象,除非你打算使用它:)

Make sure to use $.fn.property for properties that don't depend on an object, no reason to create an unneeded jquery object with $().property unless you intend to use it :)

这篇关于如何确定和打印jQuery版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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