Q:

How to toggle a jquery hash url

It been a long day, I suspect that is contributing to this seemingly simple issue.
I have a burger menu that, I need to toggle the #url on, it needs to toggle between:
Open = #open
Close = #close

My jquery code looks like this:
        $('.menu').click(function () {
            $(this).attr("href","#close");
        });

and my html looks like this:
 <a href="#open" class="menu">
   <b></b>
   <b></b>
   <b></b>
   <span>Menu</span>
</a>

I can open the menu fine, I can close it too, however, once I have closed the menu I can't then open it again since the href is still showing as #close. So, I wondered how I can toggle it so whatever the url, the href is the opposite?
I Appreciate any help.

A:

Just check what is the href attribute value every time the menu is clicked and change it's value?
This should work:
$('.menu').click(function() {
    if($(this).attr("href") == "#open") {
        $(this).attr("href", "#close");
    } else {
        $(this).attr("href", "#open");
    }
});

