How to determine and print jQuery version?

后端 未结 7 1367
北恋
北恋 2021-01-31 14:06

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

相关标签:
7条回答
  • 2021-01-31 14:30
    $().jquery;
    

    This will return a string containing the jQuery version

    0 讨论(0)
  • 2021-01-31 14:36

    try

    alert($().jquery)
    
    0 讨论(0)
  • 2021-01-31 14:38

    Alert is good, but if you want to actually print the jquery version...

    <script>
    document.write($.fn.jquery);
    </script>
    
    0 讨论(0)
  • 2021-01-31 14:41

    I'm not sure how many versions of jQuery this exists in, but a jQuery object has a jquery property that stores the version.

    alert( $().jquery );
    

    Will alert 1.4.2 if you're using that version.

    0 讨论(0)
  • 2021-01-31 14:42
    $().jquery; // yields the string "1.4.2", for example
    

    Source: http://jquery-howto.blogspot.com/2009/02/how-to-check-jquery-version.html

    0 讨论(0)
  • 2021-01-31 14:45
    alert( $.fn.jquery )
    
    0 讨论(0)
提交回复
热议问题