Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,493 members, 7,954,894 topics. Date: Saturday, 21 September 2024 at 11:54 AM |
Nairaland Forum / Science/Technology / Webmasters / Let's Play Around With Some Javascript (451 Views)
Snow Effect On Blog: How To Add Snow Falling Effect Javascript For Blogger / Post All Your Web Development Issues Here (php, Sql, Html, Javascript, Css) (2) (3) (4)
Let's Play Around With Some Javascript by marin63(m): 5:24pm On May 07, 2015 |
I just took on a lesson and came of with something nice. Let's see how you can achieve this little snippet. QUESTION: Create an input password with toggling ability from asterisk to normal text... I will post mine immediately after the first comment. |
Re: Let's Play Around With Some Javascript by marin63(m): 6:42pm On May 07, 2015 |
hmm, lemme post mine then. HTML MARKUP: <html> <head> <title>Toggle Password Visibility</title> </head> <body> <input type="password" placeholder="Insert Password" id="password"> <input type="button" value="Show Password..." id="button" onclick="visibility()"> </body> </html> JAVASCRIPT CODE: function visibility(){ var type = $('#password').attr('type'); if(type == 'password'){ $('#password').attr('type', 'text'); $('#button').attr('value', 'Hide Password...'); }else if(type == 'text'){ $('#password').attr('type', 'password'); $('#button').attr('value', 'Show Password...'); } } |
Re: Let's Play Around With Some Javascript by Craigston: 6:56pm On May 07, 2015 |
I've not gone into JavaScript much but it may be done by toggling the 'type' attribute of the <input> element between 'password' and 'text'. |
Re: Let's Play Around With Some Javascript by thewebcraft(m): 7:56pm On May 08, 2015 |
Craigston:This is just a simple jquery method |
(1) (Reply)
I Need An Animator Urgently / Make N50,000 Or More As A Developer For Using Wowpay For Clients / Joomla Issues
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 8 |