The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
4 posters

    hide and show password

    omarpop23
    omarpop23
    Forumember


    Male Posts : 182
    Reputation : 3
    Language : Arabic
    Location : Egypt

    Solved hide and show password

    Post by omarpop23 October 12th 2017, 8:56 am

    how can i make a button to hide and show passwords

    i wote that code but doesn't work
    Code:
    $(function(){
      $('input[name="password"]').replaceWith('<input type="password" name="password" size="25" maxlength="25" class="inputbox autowidth" /> <span style="font-family: FontAwesome;" id="shIcon"></span>');
      $('input[name="password"]').attr('id', 'password');
    });


      var myInput = document.getElementById("password"),
          myBtn   = document.getElementById("shIcon");

       myBtn.onclick = function () {
            if (this.textContent === "" ) {
              myInput.setAttribute('type','text');
              this.textContent('')
              } else {
                myInput.setAttribute('type','password');
                this.textContent('');
                }
     };
    omarpop23
    omarpop23
    Forumember


    Male Posts : 182
    Reputation : 3
    Language : Arabic
    Location : Egypt

    Solved Re: hide and show password

    Post by omarpop23 October 12th 2017, 8:59 am

    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19325
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: hide and show password

    Post by Ape October 12th 2017, 11:15 am

    Please don't double post. Your posts need to be separated by 24 hours before bumping. Please use the edit button, instead!
      This is your 3rd warning about this any more and we will be marking you on your warning bar Mad

    Please read our forum rules:  ESF General Rules



    hide and show password Left1212hide and show password Center11hide and show password Right112
    hide and show password Ape_b110
    hide and show password Ape1010
    omarpop23
    omarpop23
    Forumember


    Male Posts : 182
    Reputation : 3
    Language : Arabic
    Location : Egypt

    Solved Re: hide and show password

    Post by omarpop23 October 13th 2017, 5:14 am

    close topic iolved it
    Code:
    // Show/Hide password

    $(function() {
     $('input[name="password').attr('id','password');
     $('<span class="show-pass" id="shIcon"></span>').insertAfter('input[name="password');
     $('head').append('<style rel="stylesheet" type="text/css">.hide-pass:after {content:"hide";}.show-pass:after {content: "show";}</style>
    ');
       

        var myInput = document.getElementById("password"),
            myBtn = document.getElementById("shIcon");

        myBtn.onclick = function() {
            if(myInput.type === "password") {
                myInput.type = 'text';
                this.className = 'hide-pass';
            } else {
                myInput.type = 'password';
                this.className = 'show-pass';
            }
        };
    });
     
    //by omarpop23
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: hide and show password

    Post by SLGray October 13th 2017, 5:37 am

    Where exactly does this appear on your forum?



    hide and show password Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    omarpop23
    omarpop23
    Forumember


    Male Posts : 182
    Reputation : 3
    Language : Arabic
    Location : Egypt

    Solved Re: hide and show password

    Post by omarpop23 October 13th 2017, 1:33 pm

    this is my first trick
    look
    hide and show password 20171010
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: hide and show password

    Post by SLGray October 13th 2017, 6:50 pm

    So it is for logging in? I really do not see why you would want this.



    hide and show password Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Ace 1
    Ace 1
    Helper
    Helper


    Male Posts : 843
    Reputation : 64
    Language : English - French?
    Location : Druid Hill Park

    Solved Re: hide and show password

    Post by Ace 1 October 13th 2017, 6:57 pm

    SLGray wrote:So it is for logging in? I really do not see why you would want this.

    It's so people can see if they made a mistake entering their password. And by the way, I think he wants it marked as solved.

    omarpop23 wrote:close topic iolved it
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: hide and show password

    Post by SLGray October 13th 2017, 7:01 pm

    Problem solved & topic archived.
    Please read our forum rules: ESF General Rules



    hide and show password Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.

      Current date/time is September 22nd 2024, 11:31 pm