Check for ‘#’ hash in URL using jQuery

In this short post, find jQuery code to check if URL contains "#" (hash) or not. This can be checked via location.hash property provided by JavaScript and same can be used in jQuery.

$(document).ready(function(){
    if(window.location.hash) {
      // # exists in URL
    } 
    else {
       // No # in URL.
    }
});

Feel free to contact me for any help related to jQuery, I will gladly help you.



Responsive Menu
Add more content here...