How to check if the jQuery library is loaded ?

Method 1:

<script type="text/javascript">
window.onload = function()
{
    if (window.jQuery)
    {
        alert('jQuery is loaded');
    }
    else
    {
        alert('jQuery is not loaded');
    }
}
</script>

Method 2:

if (typeof jQuery != 'undefined') { alert("jQuery library is loaded!"); }else{ alert("jQuery library is not found!"); }


Method 3:

if (jQuery) {  

   alert("jQuery library is loaded!");

} else {

   alert("jQuery library is not found!");

}

Leave a Reply

Your email address will not be published. Required fields are marked *