Find and Show jQuery Version

It is sometimes handy to check the jQuery version so that if needed then you can write version specific code. There are two ways by which you can find the jQuery version.


For example, If jQuery 1.7.2 version is used
<script type="text/javascript"src="Script/jquery-1.7.2.js"></script>
Method 1
$(document).ready(function()
{
   alert($().jquery);
});
It will display 1.7.2 in alert.

Another method:
$(document).ready(function()
{
   alert(jQuery.fn.jquery);  
});
Same way you can also check for jQuery UI library version.For example, if you are using jQuery UI version 1.8.2
<script type="text/javascript"src="Script/jquery-ui-1.8.2.min.js"></script>
Method 1
$(document).ready(function()
{
   alert($.ui.version);
});
It will display 1.8.2 in alert.

Another method:
$(document).ready(function()
{
   alert(jQuery.ui.version);  
});
You can also check whether jQuery UI is loaded or not.
$(document).ready(function()
{
 if($.ui)
   {
     //jQuery UI is loaded
   }
   else
   {
    //jQuery UI is not loaded
   } 
});
Feel free to contact me for any help related to jQuery. I will gladly help you.
SHARE

Nothing shocks me, I'm a Software Engineer. And I am not young enough to know everything. I live in World Wide Web and from there take care of this website. This website communicates about my work, learning and experience. I believe life is short, and it is for loving, sharing, learning and connecting. So lets connect..