April 25, 2014

Change the input field from text to password on blur and vice-versa on click/focus/type?

Example of a form where the titles of the inputs are in the text box. When a user type/click or focus on the text box the value in the text box must be in clear text. And onblur the clear text must be converted into 'password' field.

<TABLE align="center">
<TR>
<TD>Card Number: </TD>
<TD>
<input class='FieldText'   type='text' name='cardNo' id='cardNo' size="20" maxlength="16"
onfocus="if (this.value != '') {setAttribute('type', 'text'); }"  
onblur="if (this.value != '') {setAttribute('type', 'password'); }" >
</TD>
</TR>

-K Himaanshu Shukla...



Copyright © 2014 - ScrutinyByKHimaanshu

No comments:

Post a Comment