-
-
Save BigMcLargeHuge/8b7763ce61aa637a7b8a to your computer and use it in GitHub Desktop.
gist for EminenceHC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Would put each of the variables into an object | |
var myVariables={}; | |
// giving values to variables (you can do this through whatever means you were intending) | |
myVariables['varAlcohol']="some value"; | |
myVariables['varMarijuana']="some other value"; | |
myVariables['varElse']="some else other value" | |
// Look for a change to the array of variables | |
$(myVariables).change(function(){ | |
var isZero=true; | |
// By itterating over each value in the array and setting isZero false for nonzero instances, you can be sure that the only situation in which isZero will be true is if all are zero | |
myVariables.forEach(function(myVariable){ | |
if($(myVariable).val()!="0"){ | |
isZero=false; | |
} | |
}); | |
if(isZero==true){ | |
$('#crafft').hide("fast"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment