Skip to content

Commit 90e5166

Browse files
authored
first commit to deploy this
1 parent 6795c35 commit 90e5166

File tree

3 files changed

+174
-0
lines changed

3 files changed

+174
-0
lines changed

index.html

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Palindrome Number </title>
8+
9+
<link rel="stylesheet" href="style.css">
10+
11+
</head>
12+
<body>
13+
14+
<div class="wrapper">
15+
<header>
16+
<h1><u>Palindrome Checker</u></h1>
17+
<p>
18+
<h5>
19+
A <strong>palindrome</strong> is a word, number, phrase, or other sequence of characters which
20+
<b>reads the same backward as forward, such as madam or racecar.</b>
21+
</h5>
22+
</p>
23+
24+
25+
</header>
26+
27+
<div class="inputs">
28+
<input type="text" placeholder="Enter Text Or Number">
29+
<button>Check Palindrome </button>
30+
</div>
31+
32+
<p class="info-text"></p>
33+
</div>
34+
35+
36+
37+
<script src="script.js"></script>
38+
</body>
39+
</html>

script.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const txtInput = document.querySelector(".inputs input"),
2+
checkBtn = document.querySelector(".inputs button"),
3+
infoTxt = document.querySelector(".info-text");
4+
let filterInput;
5+
6+
7+
checkBtn.addEventListener("click", () =>{
8+
9+
infoTxt.style.display = "block";
10+
11+
12+
// splitting user input character and join them in a single line
13+
let reverseInput = filterInput.split("").reverse().join("");
14+
15+
if(filterInput != reverseInput){
16+
return infoTxt.innerHTML = ` No, <span>'${txtInput.value}'</span> isn't a Palindrome!`;
17+
18+
// return console.log("Not Palindrome ");
19+
}
20+
21+
return infoTxt.innerHTML = ` Yes, <span>'${txtInput.value}'</span> It's a Palindrome!`;
22+
23+
// console.log("Yes! Palindrome");
24+
});
25+
26+
27+
28+
29+
txtInput.addEventListener("keyup", () => {
30+
31+
// removing spaces and all special character from entered value
32+
filterInput = txtInput.value.toLowerCase().replace(/[^A-Z0-9]/ig, "");
33+
34+
if(filterInput){
35+
return checkBtn.classList.add("active");
36+
}
37+
checkBtn.classList.remove("active");
38+
infoTxt.style.display = "none";
39+
})

style.css

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/* importing google fonts here */
2+
@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital@1&display=swap");
3+
4+
5+
/* /* adding universal class */
6+
*{
7+
margin: 0;
8+
padding: 5px;
9+
box-sizing: border-box;
10+
font-family: "Poppins", sans-serif;
11+
}
12+
13+
body{
14+
display: flex;
15+
align-items: center;
16+
justify-content: center;
17+
min-height: 100vh;
18+
background: rgb(255, 185, 255);
19+
}
20+
21+
.wrapper{
22+
max-width: 500px;
23+
padding: 20px 25px 15px;
24+
background: #fff;
25+
border-radius: 10px;
26+
;
27+
}
28+
29+
header h1{
30+
font-size: 21px;
31+
font-weight: 500px;
32+
}
33+
34+
header p{
35+
margin-top: 5px;
36+
font-size: 10px;
37+
color: #474747;
38+
}
39+
40+
.inputs{
41+
margin: 20px 0 27px;
42+
43+
}
44+
45+
.inputs input{
46+
width: 100%;
47+
height: 60px;
48+
outline: none;
49+
font-size: 19px;
50+
padding: 0 17px;
51+
border: 2px solid #999;
52+
53+
}
54+
.inputs input:focus{
55+
box-shadow: 0 3px 6px rgba(17, 219, 125, 0.15);
56+
}
57+
58+
.inputs button{
59+
width: 100%;
60+
height: 56px;
61+
outline: none;
62+
border: none;
63+
opacity: 0.7;
64+
cursor: pointer;
65+
margin-top: 22px;
66+
font-size: 17px;
67+
color: #fff;
68+
border-radius: 8px;
69+
pointer-events: none;
70+
background: rgb(119, 23, 119);
71+
72+
73+
/* pointer-events: none; */
74+
/* opacity: 0.7; */
75+
76+
77+
}
78+
79+
.inputs button.active{
80+
opacity: 1;
81+
pointer-events: auto;
82+
}
83+
84+
.info-text{
85+
font-size: 19px;
86+
text-align: center;
87+
margin-bottom: 18px;
88+
89+
90+
display: none;
91+
}
92+
93+
.info-text span{
94+
color: rgb(36, 18, 192);
95+
96+
}

0 commit comments

Comments
 (0)