如何确定网页是否启用了jquery?
问题描述:
确定网页是否启用了jquery的最佳方法是什么?使用jquery本身,如果这是确定它的最佳方法。
What is the best way to determine if a webpage is jquery enabled? Using jquery itself if that's the best way to determine it.
答
if(jQuery) //jquery object exists
jQuery不是魔术 - 它本质上只是一个大对象。您可以像检查任何其他对象一样检查它。
jQuery isn't magic - it's essentially just a big object. You can check for it like you would any other object.
确保加载jQuery中的库同样如此:
Same thing to ensure libraries within jQuery are loaded:
if(jQuery.DatePicker) //lib exists