问题描述
我想在用户将鼠标悬停在输入上时显示错误提示。如果用户修复了错误,我不希望在他们悬停时再显示提示。我有下面的内容来显示它,但是当用户将鼠标悬停在输入框上时,我无法弄清楚如何阻止它显示。有人可以帮忙吗?
$().ready(function () {
const initialTippy = tippy(document.querySelector('.tippy'));
}
// Simplified validation for this question.
function validate() {
if (isValid) {
// Kill the tippy message...which I need help with.
// initialTippy.destroy() does not work and I do not get an error.
}
else {
toggleErrorMessage('You have an error'); // Works when I hover over highlighted input Box.
}
}
// If my input does not validate,this is called.
function toggleErrorMessage(message) {
tippy('.tippy',{
trigger: 'mouseenter',onShow(instance) {
instance.setProps({ content: message });
}
});
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)