我在使用正则表达式验证的验证错误消息中使用Tipso工具提示插件,当初次输入无效字符时有效,但是在有效字符之后输入无效字符时,它将显示其默认的空白绿色工具提示。 / p>
示例:
脚本:
$(document).ready(function() {
$("#test").on('input',function () {
if(/\D/g.test(this.value))
{
this.value = this.value.replace(/\D/g, '');
$(this).tipso({
content: "Invalid Number!",
background: '#FFFAF0',
color: '#000000',
width : 150,
delay : 50,
position :'bottom'}).tipso('show');
}
else {
$(this).tipso('hide');
}
});
});
即使要同时输入有效和无效的字符,我也要显示工具提示。