简体   繁体   中英

.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);
});

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM