I have a variable I'm setting to true
, then later checking things in a couple different functions and re-setting it to false if a check fails.
Setting it here...
$(document).ready(function() {
//Set enable_submit to true, then run checks to see if it should be reset to false
var enable_submit = true;
}
Doing other checks. Then, seeing if it's still true or not here...
function change_submit_button_state() {
if (enable_submit == true) {
$("button[type=submit]").prop("disabled", false);
} else {
$("button[type=submit]").prop("disabled", true);
}
}
The problem is I'm getting a "ReferenceError: enable_submit is not defined" and the line referenced in the error is the if (enable_submit == true) {
line from above.
Is there a way around this?