If you run your example and open your browser's developer console, you'll see an error like this:
Uncaught ReferenceError: num1 is not defined
This is because to access Squiffy attributes from JavaScript, you need to use get
. To set attributes, use set
.
For example:
if ( get("num1") < get("num2")*0.20 ) {
set("message", "poor");
} else if ( get("num1") < get("num2")*0.30 ) {
set("message", "average");
} else {
set("message", "good");
}