Ok, the main issue was with the change
function. I got it working like this:
$(document).on("change",'#product-select-option-0', function() {
var productquantity = $('#quantity').attr('value');
if (productquantity == 0) {
$('#add-to-cart').prop('disabled', true);
}
})
Also changed =
to ==
and .attr('max');
to .attr('value');
(as max is only supported in Internet Explorer 10, Opera, Chrome, and Safari).