2

Possible Duplicate:
Modifying document.location.hash without page scrolling

How to prevent scrolling down the page to the hashtag when the hash has changed? I tried the following method:

$("#button_bar a").click(function(event) {
    event.preventDefault(); //This was to prevent the hash scroll down behavior

    window.location.hash = this.hash; //This makes scroll down to the hash again

    $(window).hashchange( function(){ //this recognizes if the hash has changed
        recognizeHashTag();  //this identifies the hashtag and fires an ajax call
    });
});

The problem is when I quote window.location.hash = this.hash, it does not do anything. And when it is unquoted the hash behavior comes back again. If someone has an idea thanks a lot.

Community
  • 1
  • 1

0 Answers0