View Single Post
Old 08-23-2012, 09:41 PM   PM User | #2
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
I can't see your div with id of 'content', but presumably it is there somewhere.

From jQuery 1.6 prop() is intended to specifically return a property, so you should use attr() to return an attribute.

Code:
$(function () {
    $('#ul1 li a').on('click', function(e){
        e.preventDefault();
        var page_url=$(this).attr('href');
        $('#content').load(page_url);
        return false;
    });
});
on() was added in jQuery 1.7 so check the version that you are using.

preventDefault() should work, to prevent the default link being followed, but there is no harm in including 'return false' as well.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS

Last edited by AndrewGSW; 08-23-2012 at 09:43 PM..
AndrewGSW is offline   Reply With Quote