jQuery won't parse xml with nodes called option
- by user170902
hi all,
I'm using jQuery to parse some XML, like so:
function enumOptions(xml) {
$(xml).find("animal").each(function(){
alert($(this).text());
});
}
enumOptions("<root><animal>cow</animal><animal>squirrel</animal></root>");
This works great. However if I try and look for nodes called "option" then it doesn't work:
function enumOptions(xml) {
$(xml).find("option").each(function(){
alert($(this).text());
});
}
enumOptions("<root><option>cow</option><option>squirrel</option></root>");
There's no error, just nothing gets alerted, as if the find isn't finding anything. It only does it for nodes called option everything else I tested works ok!
I'm using the current version of jQuery - 1.4.2.
Anyone any idea?
TIA.
bg