Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用 IF 语句检查 jQuery 的特定版本(1.6)。我知道您通常可以为 jQuery 做到这一点,但我需要一些更细化的东西。
是的; jQuery 文档在搜索关键字"version"时告诉我们要写:
"version"
alert( 'You are running jQuery version: ' + $.fn.jquery );
然后:
该.jquery属性被分配给 jQuery 原型,通常由它的别名来引用$.fn。它是一个包含 jQuery 版本号的字符串,例如“1.5.0”或“1.4.4”。
.jquery
$.fn
这应该有效。
jQuery.fn.jquery;
博客参考