I have a javascript snippet, which intercepts link clicks and turns them to hashes (I know that hash-id isn't in the W3C Recommendations :) )
$("a").click(function(event) {
event.preventDefault();
newHash = $(this).attr("hash-id");
console.log(newHash);
if (typeof newHash === "undefined"){
window.location = $(this).attr("href");
}
else{
window.location.hash = "#" + newHash;
}
});
Basically whenever a user clicks any link, it's supposed to get it's "hash-id" if there is none, than it just loads the page regularly. Now: it works great on my site, footer, header, but after I click an "injected" content
$("#container").load(href + " #content");
It doesn't work, doesn't return any output to console, alert, nada.
I tried putting the code at the begining, end, footer, in both pages, but nothing works, anyone got any clue how to make it work?
$("a").live("click", function(){..})?