I'm using AJAX to receive an XML response, which I then need to manipulate. By using jQuery's context option, I can select from the XML data, but I am still unable to write to it.
$('blah', xml)
selects xml just fine, but
$('blah', xml).removeClass( 'myClass' )
seems to do nothing to the xml variable! How can I achieve the functionality I'm looking for?
Example:
var data = null;
$(document).ready(function(){
$.ajax({
type:"GET",
url:"blah/blah.jsp",
success:function(msg)
{
data = msg;
init();
}
});
function init()
{
$('#myElement', data).removeClass('hidden');//removeAttr('class') also fails
}
Example xml file:
<root>
<div>
<!--lots of content -->
</div>
<div>
<p id = "myElement<->" class = "hidden">
Test!
</p>
</div>
</root>