Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,155,754 members, 7,827,782 topics. Date: Tuesday, 14 May 2024 at 04:57 PM

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

Nairaland Forum / Science/Technology / Webmasters / Let's Play Around With Some Javascript (432 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)

(1) (Reply) (Go Down)

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

Wordpress Search Engine Optimization: 6 Useful Tips And Tricks / Blogging Expert, Please Help / Becoming A Susscesful Freelance Designer

(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. 9
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.