Jump to content

JQUERY .clone() with css


radish
 Share

Recommended Posts

Hey all.I recently posted a problem I was having with loading XML using javascript/Jquery as DOM elements into my website dynamically.Now the page is loading my XML content fine but for some reason it isn't treating the nodes as html nodes.my XML is laid out theoretically like this

<page>	<section>		 <h2>lorem ipsum</h2>		 <p>lorem ipsum</p>	</section></page>

I am using html5 elements and they are showing up properly in firebug when i check the document

<div id="main">   <section>		 <h2>lorem ipsum</h2>		 <p>lorem ipsum</p>   <section></div>

However my problem is that objects that are cloned using the .clone() method in my code won't have the default browser css applied to them.instead i have to hard code the styling in css for every object I clone in order for that object to have any css.is there any way I can apply the default css to these DOM objects without hard coding the css for every single element that i load dynamically?this is the code i'm using to clone() the XML objects.

function loadPage(pageName) {	// TESTING TO GET XML CONTENT	$("div#main").append( $(XML_DOC).find("page#" + pageName).children().clone(true) );}

Link to comment
Share on other sites

This is a legacy page I created that my website will default too in case javascript or xml don't work.This is how the content is supposed to look5890638864_4f5d3bca80.jpgthis is how it shows up when using .clone() from an XML object.5890071335_02029b3e8e.jpg

Link to comment
Share on other sites

This is a legacy page I created that my website will default too in case javascript or xml don't work.This is how the content is supposed to look5890638864_4f5d3bca80.jpgthis is how it shows up when using .clone() from an XML object.5890071335_02029b3e8e.jpg
bump anyone any ideas?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...