ANSWER FOUND!
I’m reading an xml document and I am sending this to a function
$(data).find('colleges').attr('next')
that returns discipline and javascript is thinking it’s a variable, can I some how get the attribute in the tag and have it return as a string like 'discipline'
Is there a toString()-type method that I could add onto the selection?
$(data).find('colleges').attr('next').toString()
The issue I am having is that I am sending that to a function
createSelect( $(data).find('colleges').attr('next') )
but firebug is giving me an error saying that the value, discipline, is undefined? Why is javascript reading discipline as a var and not a string?
If this…
…doesn’t find any matches (
<colleges>...</colleges>), then this……will return
undefined.The first thing you should do is test to see if the
.find()found anything.If the
alertgives you0, then there were no matches, and you’ll have to inspect yourdatato see if it contains what you expect.