How can i determine if first occurance (element 0) of contains text “No Errors”
if ($(xml).find('errors')[0].text() == 'No Errors')
{
do something
}
!!! edit !!!
found it...
if ($(xml).find('error').first().text() == 'No errors')
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Using
[0]causes JavaScript/jQuery to return the DOM node, instead of the jQuery object, you might try:Or:
Both of these
ifstatements require that the text is, not simply contains, equal to'No Errors'.To test that the text contains the text ‘No Errors’:
JS Fiddle demo.
References:
:first.eq().toLowerCase().indexOf().