Get part of URL using jquery
<p>I have been googling, a lot, and found quiet many similar issues around the www but not anything that nails my issue to the ground.</p>

<p>I have a jquery function that get the href attribute from an anchor tag, which is supposed to return this value - #SomeIDHere</p>

<p>On my development environment  it works perfectly, but on production it returns the current URI + the #ID. I only need the #ID part to make the rest of the script work as intended.</p>

<p>This is how I get the href, now I only need to split the href value and get the #ID part.</p>

<pre><code>function myFunction(sender) {
    var id = sender.getAttribute('href');
    alert(id);
    // functionallity here...
}
</code></pre>

<p>I have tried this <a href="http://stackoverflow.com/questions/4059193/jquery-href-anchor-value">solution</a> which was a brilliant start but when I tried implementing it I only got undefined values or javascript errors.</p>

<p>Some of the things I tried:</p>

<pre><code>function myFunction(sender) {
var id = sender.getAttribute('href');
var newID = $(id).search.split('#')[1]; // got an error
alert(id);
// functionallity here...
}

function myFunction(sender) {
var id = sender.getAttribute('href');
var newId = $(id).split('#')[1]; // got an error
// functionallity here...
}

function myFunction(sender) {
var id = sender.getAttribute('href');
var newId = $(sender)[0].search.split('#')[1]; // returned undefined
// functionallity here...
}
</code></pre>

<p>Any thought or ideas of how to do this? I'm kind of lost at the moment.</p>
