The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

hide and show password

View previous topic View next topic Go down

Solved hide and show password

Post by omarpop23 on 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('');
            }
 };
avatar
omarpop23
Forumember

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

http://egyover.ahlamontada.com

Back to top Go down

Solved Re: hide and show password

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

avatar
omarpop23
Forumember

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

http://egyover.ahlamontada.com

Back to top Go down

Solved Re: hide and show password

Post by APE on 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



avatar
APE
Manager
Manager

Male Posts : 10827
Reputation : 1008
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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

Back to top Go down

Solved Re: hide and show password

Post by omarpop23 on 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
avatar
omarpop23
Forumember

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

http://egyover.ahlamontada.com

Back to top Go down

Solved Re: hide and show password

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

Where exactly does this appear on your forum?


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40523
Reputation : 2733
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

Solved Re: hide and show password

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

this is my first trick
look
avatar
omarpop23
Forumember

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

http://egyover.ahlamontada.com

Back to top Go down

Solved Re: hide and show password

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

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


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40523
Reputation : 2733
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

Solved Re: hide and show password

Post by Ace 1 on 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
avatar
Ace 1
Helper
Helper

Male Posts : 823
Reputation : 62
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: hide and show password

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

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


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40523
Reputation : 2733
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


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