Home / Snippets / How to View Toggle Password On and Off using jQuery
How to View Toggle Password On and Off using jQuery cover

How to View Toggle Password On and Off using jQuery

304

2 years ago

0 comments

To toggle the view password field on and off you can simply make use of jQuery "mouseup" and "musedown" event. The way to view the password value is simply by changing the input field type from "password" to "text". Do check the code implementation below for the full code example.
$("#password-show-button").mouseup(function () {
    $("#password").attr("type", "password");
});

$("#password-show-button").mousedown(function () {
    $("#password").attr("type", "text");
});
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this