首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用jquery或其他库的表单提示

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

Stack Overflow用户
提问于 2010-05-30 16:07:49
回答 1查看 606关注 0票数 0

这是jquery的表单验证:

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

我需要这样的东西,但是当我通过单击选择输入文本表单时,提示必须出现,而当我选择另一个输入文本表单时,提示必须消失。

有没有办法使用jquery、mootools、scriptaculus或其他库来做到这一点?

谢谢^_^

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-05-30 16:24:59

在jquery中,我会这样做:

代码语言:javascript
复制
$('input').focus(function(){
  $(this).sibling('div.form_tooltip').show();
});
$('input').blur(function(){
  $(this).sibling('div.form_tooltip').hide();
});

对应的html:

代码语言:javascript
复制
<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>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2937933

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档