Friday, January 1, 2016

JQuery: CheckBox show/Hide password when changed

11:30 PMFriday, January 1, 2016
In this article, I will show you, How to show password when we select "Show PassWord" checkbox. If check box is selected then show password otherwise hide. Also I will show you, when we enter some text into the password box then entered text write on the span tag. If you want to learn that how I design it, Follow the following steps:
Step-1 :  Add two TextBox in the body section, also add one span tag and one button control.
Step-2 :  Run Jquery function, get the Id property of  password textbox, apply keyup  function on password textbox. It means when you enter some text into password box then enter text printed together with the cursor. 
Step-3 : Check whether CheckBox is checked or not. If check then write text on span tag.

Complete Code:
<!DOCTYPE html>
<html xmlns="">
    <script src=""></script>
        $(function () {
            $('#passtxt').keyup(function () {
                var ischecked = $('#chktxt').prop('checked');
                if (ischecked) {

            $('#chktxt').change(function () {
                var ischecked = $(this).prop('checked');
                if (ischecked) {


<form id="form1">
    UserName:<input type="text" id="usertxt"/><br/>
    Password:<input type="password" id="passtxt"/><br/>
    <span id="spantxt" style="display:none"></span>
    <input type="checkbox" id="chktxt"/>Show Password
    <input type="button" value="login"/>


Protected by Copyscape Online Copyright Protection Software


Post a Comment

Toggle Footer