Tuesday, 10 May 2016

// // Leave a Comment

How to Enable/Disable the password using JavaScript and CSS?

As we apperceive that for the aegis purpose, we accept apparent password consistently password approach agency in ammo form, but abounding times we wish to appearance password on bang on a control. So this cipher will be allowance you and its attending as well good.

Source Code:-
<%@ Page Language="C#" AutoEventWireup="true"CodeFile="hideandshowpassword.aspx.cs"
    Inherits="hideandshowpassword" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>Show Hide Password</title>
    <script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript">
        function ShowHidePassword(ID) {
            if (document.getElementById($("#" + ID).prev().attr('id')).type == "password") {
                $("#" + ID).attr("data-hint""Hide");
                $("#" + ID).find("i").removeClass("icon-eye").addClass("icon-eye-slash");
                document.getElementById($("#" + ID).prev().attr('id')).type = "text";
            }

            else {
                $("#" + ID).attr("data-hint""Show");
                $("#" + ID).find("i").removeClass("icon-eye-slash").addClass("icon-eye");
                document.getElementById($("#" + ID).prev().attr('id')).type = "password";
            }
        }
    </script>
    <style type="text/css">
        body {
            width500px;
            margin20px;
            font-family"Titillium"Arialsans-serif;
        }

        .textAreaBoxInputs {
            min-width260px;
            widthauto;
            height30px;
            font-size15px;
            padding7px 10px;
            border1px solid #00ff21;
            outlinemedium none;
            border-radius2px;
            line-height30px;
            floatleft;
        }

        .dvShowHidePassword {
            font-size15px;
            font-weightbold;
            margin-left-38px;
            border-left1px solid #00ff21;
            padding7px 10px;
            cursorpointer;
            line-height50px;
            ser-selectnone;
            -webkit-user-selectnone/* webkit (safari, chrome) */
            -moz-user-selectnone/* mozilla */
            -khtml-user-selectnone/* webkit (konqueror) */
            -ms-user-selectnone/* IE10+ */
        }
                @font-face {
            font-family'FontAwesome';
            srcurl('fonts/fontawesome-webfont.eot?v=4.1.0');
            srcurl('fonts/fontawesome-webfont.eot?#iefix&v=4.1.0')format('embedded-opentype')url('fonts/fontawesome-webfont.woff?v=4.1.0') format('woff')url('fonts/fontawesome-webfont.ttf?v=4.1.0') format('truetype')url('fonts/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg');
            font-weightnormal;
            font-stylenormal;
        }

        .icon {
            displayinline-block;
            font-familyFontAwesome;
            font-stylenormal;
            font-weightnormal;
            line-height1;
            -webkit-font-smoothingantialiased;
            -moz-osx-font-smoothinggrayscale;
        }


        /* makes the font 33% larger relative to the icon container */
        .icon-lg {
            font-size1.33333333em;
            line-height0.75em;
            vertical-align-15%;
        }
          .icon-eye:before {
            content"\f06e";
        }

        .icon-eye-slash:before {
            content"\f070";
        }
    </style>
</head>
<body>
    <h2>Welcome to Code Solutions</h2>

    <div style="margin-bottom: 10px;">
        Enter your password in below textbox
    </div>
    <input id="txt_Password" class="textAreaBoxInputs"type="password">
    <span id="ShowHidePassword" class="dvShowHidePassword hint--top hint--bounce hint--rounded"
        data-hint="Show" onclick="ShowHidePassword(this.id);"><iclass="icon icon-eye"></i>
    </span>
   
    <p>Please click to see the password</p>
</body>
</html>

0 comments:

Post a Comment