dsp77 Posted September 6, 2010 Share Posted September 6, 2010 i have figured how to change the input type from password to text but i could not make it back from password to text with the same button. <input type="password" name="myElement" id="pass" value="some text" /> <input name="show password" type="button" onclick="document.getElementById('pass').type = 'text';" /> any advise please Quote Link to comment Share on other sites More sharing options...
Adam Posted September 6, 2010 Share Posted September 6, 2010 You mean to toggle the type? Try this: function toggleType() { var obj = document.getElementById('pass'); if (obj.type == 'text') { obj.type = 'password'; } else { obj.type = 'text'; } } Then call it with: onclick="toggleType();" Quote Link to comment Share on other sites More sharing options...
dsp77 Posted September 6, 2010 Author Share Posted September 6, 2010 it works thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.