How do I load the background image from another page?
        Posted  
        
            by bbeckford
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by bbeckford
        
        
        
        Published on 2010-05-21T15:48:11Z
        Indexed on 
            2010/05/21
            15:50 UTC
        
        
        Read the original article
        Hit count: 280
        
Hi all,
I'm creating a page that loads content from other pages using jQuery like this:
$('#newPage').load('example.html' + ' #pageContent', function() {
    loadComplete();         
});
That all works fine.
Now what I want to do is change the background image of the current page to the background image of the page I'm loading from.
This is what I'm doing now but I can't for the life of me get it to work:
$.get('example.html', function(data) {
    var pageHTML = $(data);
    var pageBody = pageHTML.$('body');
    alert(pageBody.attr("background"));
});
What am I doing wrong??
Thanks,
-Ben
© Stack Overflow or respective owner