views:

168

answers:

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

anybody knows why JS returns false even if the passed string is "Active"? i also tried changing the code to if ($('status_'+id).getText()==String("Active")) or even

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

and still no luck T_T... 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?

+2  A: 

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

Joeri Sebrechts
A: 

T_T omg thank you so much, how did that space get in there? okee thanks

lock
Been there, done that ;)
Joeri Sebrechts
+1  A: 

The first step in any debugging task is to check your assumptions. Use a debugger or a series of alerts to check the following:

  • what's the value of id?
  • does$('status_'+id) evaluate to a DOM element?
  • what does $('status_'+id).getText() actually return
Paul Dixon