JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="u"> / <input type="text" id="d"> <hr>
<button>Is Divisible?</button> - <span id="a"></span>
JavaScript
function isDivisible(u, d) {
var numD = Math.max(u.toString().replace(/^\d+\./, '').length, d.toString().replace(/^\d+\./, '').length);
u = Math.round(u * Math.pow(10, numD));
d = Math.round(d * Math.pow(10, numD));
console.log(u + '/' + d);
return (u % d) === 0;
}
$('button').click(function() {
$('#a').text(isDivisible(parseFloat($('#u').val()), parseFloat($('#d').val())));
});