I'm getting data back from the server in XML format. The data looks like:
<items>
<item>
<field1>10</field1>
<field2>11</field2>
<field3>12</field3>
</item>
<item>
<field1>10</field1>
<field2>11</field2>
<field3>11</field3>
</item>
</items>
Is there a way to write a jQuery statement to return only the XML objects where field2
equals field3
? I currently use jQuery to filter xml objects that meet certain criteria (using jQuery find
and contains
, e.g. $("field2:contains(11)")
) but I can't come up with the statement to filter the xml where two of the xml fields are equal. I can always convert the XML to javascript arrays and look for equal fields and then return the javascript array as a jQuery object. There just seems like there should be a way to do it with a jQuery statement.