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.

hide and show password

4 posters

Go down

Solved hide and show password

Post by omarpop23 Thu Oct 12 2017, 09:56

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

View user profile http://devs.ahlamontada.com

Back to top Go down

Solved Re: hide and show password

Post by omarpop23 Thu Oct 12 2017, 09:59

omarpop23
omarpop23
Forumember

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

View user profile http://devs.ahlamontada.com

Back to top Go down

Solved Re: hide and show password

Post by Ape Thu Oct 12 2017, 12:15

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 Keep_s10
hide and show password Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 18137
Reputation : 1925
Language : fluent in dork / mumbojumbo & English haha

View user profile http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: hide and show password

Post by omarpop23 Fri Oct 13 2017, 06:14

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
omarpop23
omarpop23
Forumember

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

View user profile http://devs.ahlamontada.com

Back to top Go down

Solved Re: hide and show password

Post by SLGray Fri Oct 13 2017, 06:37

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 50623
Reputation : 3478
Language : English
Location : United States

View user profile https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: hide and show password

Post by omarpop23 Fri Oct 13 2017, 14:33

this is my first trick
look
hide and show password 20171010
omarpop23
omarpop23
Forumember

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

View user profile http://devs.ahlamontada.com

Back to top Go down

Solved Re: hide and show password

Post by SLGray Fri Oct 13 2017, 19:50

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 50623
Reputation : 3478
Language : English
Location : United States

View user profile https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: hide and show password

Post by Ace 1 Fri Oct 13 2017, 19:57

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
Ace 1
Ace 1
Helper
Helper

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

View user profile https://help.forumotion.com

Back to top Go down

Solved Re: hide and show password

Post by SLGray Fri Oct 13 2017, 20:01

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 50623
Reputation : 3478
Language : English
Location : United States

View user profile https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum