show-notice
hide-notice

Thursday 15 August 2013

Check for '#' hash in URL using jQuery


Introduction:

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.

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

SHARE THIS POST   

0 comments :

Post a Comment

Design by Gohilinfotech | www.gohilinfotech.blogspot.com