Add one more button for division but check if the second (data2) value is non-zero. If zero,
Fantastic news! We've Found the answer you've been seeking!
Question:
Add one more button for division but check if the second (data2) value is non-zero. If zero, show the message invalid input on the message div, otherwise show the result of the data1/data2
document.querySelector('#division').addEventListener('click',
function(){
let data1Value = parseInt(data1.value);
let data2Value = parseInt(data2.value);
let total = data1Value / data2Value;
message.innerHTML = total;
});
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date: