javascript - how can i toggle a <p:password> field to text and password with a checkbox check uncheck -
i using p:password tag registration. want toggle field text when checked check box, change password type mode when unchecked. how solve problem primefaces component. using primefaces 3.0 , jsf 2.0.
under cover generates <input type="password"/>
field (with other attribute name etc..)
so if need show password have check box like
<input type="checkbox" id="showpassword" onclick="showpassword()"/> show password
in javascript
function showpassword(){ var showpasswordcheckbox = document.getelementbyid("showpassword"); if(showpasswordcheckbox.checked){ document.getelementbyid("id_for_your_password_field").type="text"; }else{ document.getelementbyid("id_for_your_password_field").type="password"; } }
Comments
Post a Comment