In my header file I have some javascript that (should) apply to all links on the page
Code: Select all
$('a').click(function(e)
{
location.hash = this.id;
e.preventDefault();
loadpage(this.id);
});My index.php file has the javascript above and then I call a function to load the page based on the hashtag in the url by calling
Code: Select all
loadpage(location.hash)The problem is that any content that I get through loadpage() is not being subjected to the javascript defined previously, meaning the links aren't doing anything when they're clicked.
Is there a way to be sure the javascript applies to the content being added to the page through ajax?