I have a div with the identifier "secondHeader" and I want to replace the whole div with another div with the same identifier "secondHeader", but instead of replacing it, it simply adds the loaded div inside the first.
$("#secondHeader").load("/logged-in-content.html #secondHeader");
Here's what happens ...
<div id="secondHeader"><div id="secondHeader"></div></div>
What I want to do is div the secondHeader from the ajax load to completely replace secondHeader on the start page.
I know this sounds silly, but here is what I'm trying to accomplish ... When the user is not logged in, they see an unclaimed header. I use ajax to allow a person to enter the site, and I want to replace the unclaimed header with login through ajax.
I tried everything I know, for example ...
$("#secondHeader").replaceWith($("#secondHeader").load("/logged-in-content.html #secondHeader"));
... and using .remove () in front of the hand ...
Any ideas?
jquery
vipergtsrz Aug 27 '09 at 10:12 2009-08-27 22:12
source share