Skip to content

Commit

Permalink
[Bug]: Show and Hide Button is not working
Browse files Browse the repository at this point in the history
  • Loading branch information
SrinivasDevolper committed Jun 28, 2024
1 parent 56852b0 commit 3a060b9
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 26 deletions.
7 changes: 0 additions & 7 deletions Css-files/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@
width: 80%;
}

.back-button{
display: none;
}

@media screen and (width <= 600px) {
.card{
width: 95%;
Expand All @@ -109,9 +105,6 @@
padding-bottom: 4rem;
padding-top: 0;
}
.back-button{
display: block;
}
}

#rememberCheckbox{
Expand Down
7 changes: 0 additions & 7 deletions Css-files/signup.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@
width: 80%;
}

.back-button{
display: none;
}

@media screen and (width <=600px) {
.card {
width: 95%;
Expand All @@ -107,9 +103,6 @@
padding-bottom: 4rem;
padding-top: 0;
}
.back-button{
display: block;
}
}

@media screen and (width >= 2000px)
Expand Down
28 changes: 22 additions & 6 deletions Html-files/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
</nav>

<div class="head_container">
<button style="background:transparent;border: none; margin-left: 20px; padding-top: 10px;" class="back-button"><a href="../index.html"><i class="fa-solid fa-arrow-left" style="color: #ffffff; font-size: 18px; cursor: pointer;"></a></i></button>
<div class="mainhead">
<h1 class="m-0">LOGIN</h1>
</div>
Expand Down Expand Up @@ -112,11 +111,10 @@ <h1 class="title text-center">LOGIN</h1>
</div>
<div class="textfield">
<label for="login-password">Password</label>
<input type="password" id="login-password" name="password" placeholder="Enter Password"
required>
<span id="login-hide">
<i class='hide-icon bx bxs-hide'></i>
</span>
<input type="password" id="login-password" name="password" placeholder="Enter Password" required>
<span id="login-hide">
<i class='hide-icon bx bxs-hide'></i>
</span>
</div>
<div class="row justify-content-between">
<div class="col">
Expand Down Expand Up @@ -415,6 +413,24 @@ <h4>Follow Us</h4>
// alert(error.message);
// });
// });
document.addEventListener("DOMContentLoaded", function() {
const passwordInput = document.getElementById('login-password');
const toggleIcon = document.getElementById('login-hide');
const icon = toggleIcon.querySelector('i');

toggleIcon.addEventListener('click', function() {
if (passwordInput.type === "password") {
passwordInput.type = "text";
icon.classList.remove('bxs-hide');
icon.classList.add('bxs-show'); // Change the icon class as needed
} else {
passwordInput.type = "password";
icon.classList.remove('bxs-show');
icon.classList.add('bxs-hide'); // Change the icon class as needed
}
});
});

</script>
</body>

Expand Down
32 changes: 26 additions & 6 deletions Html-files/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
</nav>

<div class="head_container">
<button style="background:transparent;border: none; margin-left: 20px; padding-top: 10px;" class="back-button"><a href="../index.html"><i class="fa-solid fa-arrow-left" style="color: #ffffff; font-size: 18px; cursor: pointer;"></a></i></button>
<div class="mainhead">
<h1 class="m-0">SIGN UP</h1>
</div>
Expand Down Expand Up @@ -117,11 +116,11 @@ <h1 class="title">SIGN UP</h1>
</div>
<div class="textfield">
<label for="signup-password">Password</label>
<input type="password" id="signup-password" name="password" placeholder="Enter Password"
required>
<span id="signup-hide">
<i class='hide-icon bx bxs-hide'></i>
</span>
<input type="password" id="signup-password" name="password" placeholder="Enter Password" required>
<span id="signup-hide">
<i class='hide-icon bx bxs-hide'></i>
</span>

</div>
<button type="submit" class="btn-login">Register</button>
<h1 class="text-center">Already have an account
Expand Down Expand Up @@ -317,6 +316,27 @@ <h4>Follow Us</h4>
// alert(error.message);
// });
// });
document.addEventListener("DOMContentLoaded", function() {
const togglePasswordVisibility = (inputId, toggleId) => {
const passwordInput = document.getElementById(inputId);
const toggleIcon = document.getElementById(toggleId);
const icon = toggleIcon.querySelector('i');

toggleIcon.addEventListener('click', function() {
if (passwordInput.type === "password") {
passwordInput.type = "text";
icon.classList.remove('bxs-hide');
icon.classList.add('bxs-show'); // Change the icon class as needed
} else {
passwordInput.type = "password";
icon.classList.remove('bxs-show');
icon.classList.add('bxs-hide'); // Change the icon class as needed
}
});
};
togglePasswordVisibility('signup-password', 'signup-hide');
});

</script>
</body>

Expand Down

0 comments on commit 3a060b9

Please sign in to comment.