show hide password JavaScript

In this blog, we will share a snippet about Showing and Hide passwords using HTML CSS and Javascript. Before you get the source code, watch the video tutorial below. This video will help you understand the code. Videos about front-end development can be found on our YouTube Channel. If you enjoy what you see you can subscribe to the channel.




I hope you've watched the video and understood the basics. We'll learn how to hide and show a password with an eye icon. This feature is very useful and should be used on your login form for privacy. There are two steps in this process and they are easy to follow. The login form needs to be created in the first place. Then we will use some javascript code to get the show and hide the password effect. When the user clicks on the eye icon, the password will be visible in front of the viewer. When we will click on the eye slash icon the password will be hidden from the viewer.

You May Also Like:

Show Hide Password using JavaScript [ Source Code ]:


The first thing you need to do is make two files. There are two files, one is an HTML and the other is a CSS. Attach the external CSS file to the HTML file. The snippet is not Jquery depended, so we don't need to add jquery. We have inserted the javascript code underneath the HTML file but you can create a separate js file to put the code there. You can take the code from the box below and paste it into your file. The project can be opened in the browser if you want to check it out. If the code isn't working, then the source code needs to be downloaded from the download button below.

ADD HTML:




ADD CSS:




I hope you have implemented the code correctly. There are lots of snippets on the website. Clicking on the "load more" button will allow you to go to those. If you enjoy the articles and snippets on this website, please share them with other people. Thank you for visiting our website, we're glad you did.

Post a Comment

Please Do not Enter any spam link in the comment box