Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add #hash clicking to an element

When I open my page at http://www.mywebsite.com/ where I have this jQuery code :

$('#locSlideButton2').click(function() {

});

I'd like, clicking on the locSlideButton2 element, add an hash (such as #example) to the url, without make any redirect.

How can I do it?

like image 974
markzzz Avatar asked Oct 25 '11 15:10

markzzz


People also ask

What is the trick of addition?

First add the hundreds place digit in second number with the first number: 953 + 800 = 1753. Then add the then place digit in second number with the result obtained in previous step: 1753 + 60 = 1813. Next add the units place digit in the second number with the result obtained in Step 2: 1813 + 7 = 1820.


1 Answers

Using plain old vanilla JS:

window.location.hash='example';

MDN on window.location

like image 152
Some Guy Avatar answered Oct 07 '22 15:10

Some Guy