代码之家  ›  专栏  ›  技术社区  ›  xRobot

使用jquery或其他库的表单提示

  •  0
  • xRobot  · 技术社区  · 15 年前

    这是jquery的表单验证:

    http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/

    谢谢^_^

    1 回复  |  直到 15 年前
        1
  •  2
  •   Zilverdistel    15 年前

    $('input').focus(function(){
      $(this).sibling('div.form_tooltip').show();
    });
    $('input').blur(function(){
      $(this).sibling('div.form_tooltip').hide();
    });
    

    对应的html:

    <div class="form_input">
      <label for="..">label</label>
      <input type="text" name="" id="" value="" />
      <div class="form_tooltip" style="display: none;">
        Here goes the html that appears in the tooltip, you probably want this div to be positioned relatively to the div.form_input.
      </div>
    </div>
    
    推荐文章