₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,327,373 members, 8,430,706 topics. Date: Saturday, 20 June 2026 at 11:03 PM

Toggle theme

Let's Play Around With Some Javascript - Webmasters - Nairaland

Nairaland ForumScience/TechnologyWebmastersLet's Play Around With Some Javascript (486 Views)

1 Reply (Go Down)

Let's Play Around With Some Javascript by marin63(op):
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:
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'.
This is just a simple jquery method
1 Reply

Snow Effect On Blog: How To Add Snow Falling Effect Javascript For BloggerPost All Your Web Development Issues Here (php, Sql, Html, Javascript, Css)234

Make Money From Adsense Even If You Are Not ApprovedBest Business OpportunityPls Need Help On Web Design