Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is a much easier way of achieving this and it involves toggling the <code>&lt;input&gt;</code> from text to password</p> <p><a href="http://jsfiddle.net/a47QC/2/" rel="nofollow">JSFidlle 3 text fields</a></p> <p><strong>HTML</strong></p> <pre><code>&lt;input type="text" name="ssn1" id="ssn1" size="2" maxlength="3" style="text-align:center;" value="555"&gt; &amp;nbsp; &lt;input type="text" name="ssn2" id="ssn2" size="2" maxlength="2" style="text-align:center;" value="55"&gt; &amp;nbsp; &lt;input type="text" name="ssn3" id="ssn3" size="2" maxlength="4" style="text-align:center;" value="5555"&gt; &amp;nbsp; &lt;input type="button" id="ssn_button" value="Show/Hide SSN"&gt; </code></pre> <p><strong>JS</strong></p> <pre><code>$(document).ready(function(){ // Page has loaded, hide SSN1 and SSN2 $('#ssn1, #ssn2').attr({'type':'password'}); // Listen for Focus on any three fields $('#ssn1, #ssn2, #ssn3').on('focus', function(){ $('#ssn1, #ssn2').attr({'type':'text'}); }); // Listen for Blur on any three fields $('#ssn1, #ssn2, #ssn3').on('blur', function(){ $('#ssn1, #ssn2').attr({'type':'password'}); }); // Show/Hide SSN click $('#ssn_button').on('click', function(){ // Alternate SSN1 and SSN2 based on current SSN1 state if($('#ssn1').attr('type') == 'password'){ $('#ssn1').attr({'type':'text'}); $('#ssn2').attr({'type':'text'}); } else{ $('#ssn1').attr({'type':'password'}); $('#ssn2').attr({'type':'password'}); } }); }); </code></pre> <p><strong>Just for you OP :)</strong></p> <p><a href="http://jsfiddle.net/39nYQ/1/" rel="nofollow">JSFiddle 1 text field</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload