The Case of the Repeating Decimal - JS calculator

Here is my code for the JS calculator -

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) {
1 Like

Thank you very much… It worked…!!!

I solved two problem with your solutions…