Skip to content

Instantly share code, notes, and snippets.

@BigMcLargeHuge
Forked from EminenceHC/file.js
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BigMcLargeHuge/8b7763ce61aa637a7b8a to your computer and use it in GitHub Desktop.
Save BigMcLargeHuge/8b7763ce61aa637a7b8a to your computer and use it in GitHub Desktop.
gist for EminenceHC
// 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