Let's Play Around With Some Javascript - Webmasters - Nairaland
Nairaland Forum › Science/Technology › Webmasters › Let's Play Around With Some Javascript (485 Views)
| Let's Play Around With Some Javascript by marin63(op): 5:24pm On May 07, 2015*. Modified: 8:11pm 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(op): 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 |
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
The Real Deal • How Your Business Can Profit BIG Time From Email Marketing • Adsense Quick Approval Fb Boosting And Traffic