0

你好我有一个输入字段很少的表单,一旦用户输入文本字段,我想显示一些与特定字段相关的信息。到目前为止,我已经设法做到了:

 <tr>
 <td>Name&nbsp;</td>
 <td width="162"><input name="txtname" type="text" id="txtname"  /></td>
 <td width="333"><span class="style1"><br/>Enter Your Name, Preferably as per your PAN Card</span></td>
 </tr>
 <tr>
 <td>Father Name&nbsp;</td>
 <td>&nbsp;<input name="txtfname" type="text" id="txtfname"  /></td>
 <td><span>Enter Your Father Name Preferably as per your PAN Card</span></td>
 </tr>
      <tr>
        <td>PAN&nbsp;</td>
        <td>&nbsp;<input name="txtpan" type="text" id="txtpan" onblur="checkPAN()" maxlength="10"  /></td>
        <td>Enter Your PAN No. carefully</td>
      </tr>
      <tr>
        <td>Mobile Number&nbsp;</td>
        <td>&nbsp;<input name="txtmb" type="text" id="txtmb" maxlength="10"  /></td>
        <td>Enter your Mobile No. we will be in touch with you with this No In case of any further details</td>
      </tr>
      <tr>
        <td>Confirm Mobile Number&nbsp;</td>
        <td>&nbsp;<input name="txtmbcnfrm" type="text" id="txtmbcnfrm" maxlength="10"  /></td>
        <td>Reenter your Mobile No.</td>
      </tr>
      <tr>
        <td>Email Id&nbsp;</td>
        <td>&nbsp;<input name="txtemail" type="text" id="txtemail" onchange="emailval()"  /></td>
        <td>Enter your Valid email ID to which you need to receive    Acknowledgement,   </td>
      </tr>

文本字段旁边的所有信息都应该隐藏,但是当onFocus应该显示特定信息时,我可以这样做,jquery但我很困惑如何到达那里。

4

1 回答 1

6
$('input').parent().next().hide();
$('input').on('focus', function () {
    $(this).parent().next().show();
});
$('input').on('blur', function () {
    $(this).parent().next().hide();
});

这是小提琴

于 2013-05-24T08:02:25.790 回答