$("#calculate").click(function(){ var p_0 = $('#p_0').val(); var p_e = $('#p_e').val(); var computation = ((p_0 - p_e)*1.0) / (1-p_e); $('#result').html(computation.toFixed(2)); }); $("input").change(function(){ var isInvalid = $('#pDiv').hasClass('is-invalid') || $('#peDiv').hasClass('is-invalid'); if(isInvalid){ $("#calculate").prop("disabled", true); }else{ $("#calculate").removeAttr('disabled'); } });
Number required!
Number required!