views:

60

answers:

2

Right now, I have the following:

function jQueryToString( jQueryObject )
{
   return $('<div>').append(jQueryObject.clone()).remove().html();
}

Which works swimmingly in firefox, opera, chrome, and safari. However, it breaks in IE. I need to convert an XML Document object into a string, so what are my options?

A: 

Disclaimer: I haven't tried this but how about

function jQueryToString( jQueryObject )
{
   var arr = $.map(jQueryObject, function(v) {
                 return $(this).html();
             });
   return arr.join('');
}
Russ Cam
I have an xml document, so I doubt this will work.
Stefan Kendall
Yeah, it doesn't work.
Stefan Kendall
A: 

For IE, do this:

jQueryObject.each( function( e, elem ){
$('#someDiv').append( elem.xml );
} );
Stefan Kendall