diff --git a/Calculators/Logarithm-Calculator/index.html b/Calculators/Logarithm-Calculator/index.html index 9c8ba2766..1cceb4217 100644 --- a/Calculators/Logarithm-Calculator/index.html +++ b/Calculators/Logarithm-Calculator/index.html @@ -17,8 +17,10 @@

Logarithm Calculator


Calculate Logarithm of a number to any base:

-
-
+
+ +

INVALID INPUT *Base can't be 1*
+

Result:

diff --git a/Calculators/Logarithm-Calculator/script.js b/Calculators/Logarithm-Calculator/script.js index 0fe8fc6ca..a974f29f3 100644 --- a/Calculators/Logarithm-Calculator/script.js +++ b/Calculators/Logarithm-Calculator/script.js @@ -8,4 +8,13 @@ function calculateLog() { } else { alert('Invalid input. Please enter positive numbers for both the base and the number, and ensure that the base is not equal to 1.') } +} + +function validateBaseInput(base) { + const errorElement = document.getElementById('baseError'); + if (base.value == 1) { + errorElement.style.display = 'inline'; + } else { + errorElement.style.display = 'none'; + } } \ No newline at end of file diff --git a/Calculators/Logarithm-Calculator/style.css b/Calculators/Logarithm-Calculator/style.css index 2ecb1560e..c85a13e07 100644 --- a/Calculators/Logarithm-Calculator/style.css +++ b/Calculators/Logarithm-Calculator/style.css @@ -8,7 +8,6 @@ body { #heading { text-align: center; - } .content { @@ -28,12 +27,19 @@ body { margin-bottom: 15px; } +#baseError { + color: rgb(241, 63, 63); + display: none; + font-size : 15px ; +} + #number { padding: 10px 15px 10px 10px; margin-bottom: 10px; } #button { + margin-top: 20px; padding: 20px 20px 20px 20px; font-size: 20px; } \ No newline at end of file