当编辑器字段隐藏时隐藏 qTip 错误消息,当可见时显示
我的页面中有一个表格,需要 3 个步骤才能填写。对于每个步骤,字段都包含在将该步骤的元素分组在一起的 div 中。当用户移动到下一步时,我隐藏该 div 并显示下一个。最后一步后,用户确认数据并提交。此时,验证开始,验证表单(每个步骤)中的所有字段。
我使用浮动 qTips 来显示验证失败字段的错误注释。我的问题是,当失败字段不可见时,提示显示的位置混乱,而当它变得可见时,它会在屏幕上跳到正确的位置。
问题:如何让 qTip 仅在字段可见时才可见,而在字段不可见时隐藏?
生成的 qTip 有一个内部元素 htmlFor="name-of-field"
所以我想我可以使用它来将每个 qTip 与其生成字段相关联。但是,当每个步骤 div 隐藏/显示时,如何让它与字段一起隐藏/显示?
I have a form in my page that is filled out in 3 steps. For each step, fields are contained in a div grouping together elements of that step. When the user moves to the next step I hide that div and show the next one. After the last step, the users confirms the data and submits it. At this point, validation kicks in, validating ALL fields in the form (of every step).
I am using floating qTips to show error comments on validation failing fields. My problem is that the tip shows up with a messed up position when the failing field is not visible, and when it becomes visible, it jumps all over the screen to its correct position.
Question: How can I get the qTip to be visible only when the field is visible and to hide when its not?
The generated qTip has an inner element htmlFor="name-of-field"
so I guess I can use that to relate each qTip to its generating field. But how do I get it to hide/show with the field when each step div is hidden/shown?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
今天刚发现
这对我有用。检查父项目的可见性并根据该情况决定停止显示事件。 Qtip2 提供了许多像这样可取消的事件。
请参阅此处的文档: http://craigsworks.com/projects/qtip2/docs/api /活动/
Just found this today
This worked for me. Checking the visibility of the parent item and deciding to stop the show event depending on that. Qtip2 provides a number of events that are cancelable like this one.
See the docs here: http://craigsworks.com/projects/qtip2/docs/api/events/