Tyler Cowan Tyler Cowan - 1 month ago 6
jQuery Question

.prop("enabled", true): not working

I am having trouble enabling a button. I have designed a small test https://jsfiddle.net/51xea2kb/ in order to test this functionality. I test whether a number is within a range and then enable or disable a button based on this number. I have checked multiple posts and nothing seems to apply.

Javascript

function enable(TVD) {
if (TVD >= 800 - 5 && TVD <= 800 + 5) {
$('#submitButton').prop("enabled", true);
} else {
$('#submitButton').prop("disabled", true);
}
}

$('#convert-table').click(function() {
var TVD = 800.1
enable(TVD);
});

Answer Source

Is enabled a thing? Try setting disabled to false instead.