I would like to take a string and treat it as XML. Then I will be able to query with DOM via the jQuery.find. Everything was working fine in Firefox, but I realized this is not working in IE.
I am doing this:
var t = "<div><outer><inner>abc</inner><inner>def</inner></outer></div>";
alert("[" + $(t).find("outer").html() + "]");
In Firefox 3 it prints:
[<inner>abc</inner><inner>def</inner>]
In IE 7 it prints:
[]
Any workarounds for getting this to work across browsers?
Thanks.
It’s been a while, but I just realized that I forgot to post how I solved the problem with your combined ideas.
I needed an entirely client side database (no PHP).
I created a div with an HTML comment in it containing the XML. I parsed the HTML comment with this and then I converted the XML to JSON with this.
You can see my method in action here:
http://wesculpt.net/art.html
Maybe I should turn this method into a jQuery plugin.
Thanks for all your help everyone.