[jQuery] XML manipulation
I'm having some real difficulty figuring out how to manipulate xml
data with jquery. Here is my situation. I have a hidden TextArea that
contains xml data, something like this:
<items>
<item value='1' text='x'></item>
<item value='2' text='y'></item>
</items>
So, let's say I want to remove the item with value='1'.
1) I grab the value of the textarea:
var xml = $("#" + id).val();
2) I then find the node and remove it:
$(xml).find("item[value='123']").remove();
Problem is, it doesn't remove anything! It finds the node just fine,
but the remove() function doesn't seem like it is doing anything. I've
tried looping through eacy item $('item',xml).each(function.... ); and
then calling remove(); but that does not work either. Any help on how
to manipulate xml data correctly? Thank you.
Bryan