I am using this script to load pages in a css frame (div#maincontent). I want the links in the loaded pages to load in this frame instead of just “going” there. I want to do this using jquery. Here is my attempt:
$('#maincontent a').click(function(e) {
e.preventDefault();
ajaxpage($(this).attr("href"), 'maincontent');
});
Not sure what ajaxpage is, but if you’re just loading a page into a div you can simply use load
Something like this:
Edit:
If you want the loaded page to have event handlers for click too, you can use load()’s callback function for this. Like this:
Here’s an example.