jquery check if url # parameter exists

very quick query.

trying to check if url # parmeter exists.
E.G. if url is www.test.com/this.php#success

If sucess exists do x els do nothing.

Is ther a quick efficient way of checking this in jquery
Who is Participating?
leakim971Connect With a Mentor PluritechnicianCommented:
yes of course :

if( location.hash == "#success" ) {
   alert(" the url contain #success " );
else {
   alert(" the url don't contain #success " );
use :

if( location.hash != "" ) { 
   alert(" the url contain # " );
else {
   alert(" the url don't contain # " );

Open in new window

More info here : http://www.w3schools.com/jsref/prop_loc_hash.asp
bjh497Author Commented:
can we specifically test for #success
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.