Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

removing the # from window.location.hash

I have this simple script:

$(document).ready(function(){  var $yoyo = window.location.hash;  alert($yoyo);  }); 

But I need to get rid of the # symbol as I'll be using the variable to locate div ids. I've tried using .remove('#') but that doesn't seem to be working.

Many thanks in advance!

like image 982
circey Avatar asked Jul 30 '10 23:07

circey


People also ask

What is the word for removing something?

OTHER WORDS FOR eliminate 1 do away with, banish, abolish, eradicate, erase, exterminate, cut out, annihilate, weed out, stamp out, rub out. 2 throw out, exclude, drop, delete, except.

Has to be removed meaning?

HR, WORKPLACE. to force someone to leave an important job or a position of power, usually because they have behaved badly, or in a way that you do not approve of: They initiated the procedure for him to be removed from office.

What is meaning of to remove?

1a : to change the location, position, station, or residence of remove soldiers to the front. b : to transfer (a legal proceeding) from one court to another. 2 : to move by lifting, pushing aside, or taking away or off remove your hat. 3 : to dismiss from office.


1 Answers

var $yoyo = window.location.hash.substring(1); 

This simply means we're taking a substring consisting of character 1 (0-indexed, so second) onwards. See the substring docs.

like image 134
Matthew Flaschen Avatar answered Nov 08 '22 12:11

Matthew Flaschen