I am attempting to use jQuery to load a specific div from a separate page on my server into a div on the current page. The code is located in my header and it works successfully for the first two clicks on the website but not after that.
The code I'm using is:
<script type="text/Javascript">
$('a').click(function(e) {
$("#container").load($(this).attr('href') + " #wrapper");
e.preventDefault();
});
</script>
I realize the site is not complete or fully functional, but it can be tried at: dev.justapo.co right now by doing the below steps:
- Click on one of the posts
- Once the post loads, click the title in the header
- Now click any link on the page - the jQuery is broken
Any help is much appreciated, am trying to learn jQuery and not sure what I'm doing wrong here.