The Case of the Repeating Decimal - JS calculator

Here is my code for the JS calculator - http://codepen.io/docwali777/pen/ALPGBm

How do I prevent multiple decimals from being added…?

Modify your decimal code to no longer add if number contains decimal, I just wrote this as example on the fly:

$("#period").click(function() {
    if ($("#numberInput").text().indexOf('.') == -1) {
        $("#numberInput").append(".");
    }
});
1 Like

Thank you very much… It worked…!!!

I solved two problem with your solutions…