Page 1 of 1

i give up... simple IF doesnt work, what am I missing here?!

Posted: Tue Nov 05, 2013 1:12 pm
by Ram

Dear Appery,

this is driving me NUTS!!!!

i have this simple code:
code
var xfilter = Appery("list_menu").find("option:selected").text();

console.log("xfilter=" + xfilter);

alert(xfilter);

if (xfilter == "Show All") {
var xfilter='*';
alert(xfilter);
};
/code

this is the console printout:
code
xfilter=​Show All
/code

and yet i dont step into the if condition if true...

what am I missing here?!

Thanks much in advance!!!!
Best,
R.


i give up... simple IF doesnt work, what am I missing here?!

Posted: Tue Nov 05, 2013 1:43 pm
by Maryna Brodina

Hi:) We'll take a look.


i give up... simple IF doesnt work, what am I missing here?!

Posted: Tue Nov 05, 2013 1:51 pm
by Ram

Cheers!!!


i give up... simple IF doesnt work, what am I missing here?!

Posted: Tue Nov 05, 2013 2:34 pm
by Maryna Brodina

There seems to be extra spaces. Try using trim() procedure prevar xfilter = Appery("list_menu").find("option:selected").text().trim();/pre


i give up... simple IF doesnt work, what am I missing here?!

Posted: Wed Nov 06, 2013 1:19 pm
by Ram

Dear Maryna,

Thank you for your reply!

you were right, again :) the funny thing is that i thought it was some kind of white space so i tried:

< code
.replace(/\s/g, "")

but it didnt do what the Trim does...

as always, you're awesome!

Image