Search code examples
javascriptmootools

JavaScript if statement returns wrong values


Does anybody knows why this snippet returns false even if the passed string is "Active"?

if ($('status_'+id).getText()=="Active")

I've also tried changing the code to

if ($('status_'+id).getText()==String("Active"))

and

if (String($('status_'+id).getText())=="Active")

and still no luck.

I've also checked $('status_'+id).getText() through console.log to verify if it really returns "Active"

i wonder why it doesnt work? any ideas?


Solution

  • Silly question: are you sure the returned string doesn't contain spaces?