it\'s a really simple question. The or operator is not working, i am trying to display a different function for both the title and amount field name. Thank you
$
Your code is executing like this:
temp = "title" || "amount"; // two "true" values, so "title" is assigned
if (field.name == temp);{ ... };
which is effectively:
temp = "title";
if (field.name == temp) { ... }
To test one varaible against multiple strings, you have to write out the individual tests directly:
if ((field.name == "title") || (field.name == "amount")) { ... }
and if you need to test against MANY items for which this kind of stuff would get tedious, you can try an array:
if (["title", "amount", ...].indexOf(field.name) > -1) { ... }