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 1: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

http://devs.ahlamontada.com

Back to top Go down

Solved Re: hide and show password

Post by omarpop23 Thu Oct 12, 2017 1:59 am

omarpop23
omarpop23
Forumember

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

http://devs.ahlamontada.com

Back to top Go down

Solved Re: hide and show password

Post by Ape Thu Oct 12, 2017 4: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
Ape
Ape
Administrator
Administrator

Male Posts : 19449
Reputation : 2011
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: hide and show password

Post by omarpop23 Thu Oct 12, 2017 10:14 pm

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

http://devs.ahlamontada.com

Back to top Go down

Solved Re: hide and show password

Post by SLGray Thu Oct 12, 2017 10:37 pm

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 : 51568
Reputation : 3525
Language : English
Location : United States

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 6:33 am

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

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

http://devs.ahlamontada.com

Back to top Go down

Solved Re: hide and show password

Post by SLGray Fri Oct 13, 2017 11:50 am

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 : 51568
Reputation : 3525
Language : English
Location : United States

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 11:57 am

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

https://help.forumotion.com

Back to top Go down

Solved Re: hide and show password

Post by SLGray Fri Oct 13, 2017 12: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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51568
Reputation : 3525
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top


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