jQuery.load() Retrieving partial page content causes duplicate ID in DOM

Posted by Warren Buckley on Stack Overflow See other posts from Stack Overflow or by Warren Buckley
Published on 2010-05-13T08:05:30Z Indexed on 2010/05/13 8:24 UTC
Read the original article Hit count: 489

Filed under:
|

Hello all, I currently have a JS function that allows me to load partial content from another page into the current page using jQuery.load()

However I noticed when using this that I get a duplicate ID in the DOM (when inspecting with FireBug)

This function is used in conjuction with a Flash Building viewe so it does not contain any code to retrieve the URL from the anchor tag.

function displayApartment(apartmentID) {
    $("#apartmentInfo").load(siteURL + apartmentID + ".aspx #apartmentInfo", function () {
        //re-do links loaded in
        $("a.gallery").colorbox({ opacity: "0.5" });
    });
}

The code above works just fine in retrieving the content, however it just bugs me that when inspecting with firebug I get something like this.

<div id="apartmentInfo">
    <div id="apartmentInfo">
        <!-- Remote HTML here..... -->
    </div>
</div>

Can anyone please suggest anything on how to remove the duplicate div?

Thanks, Warren

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ajax