工具提示在第二次验证失败时未显示

时间:2019-09-08 13:12:53

标签: jquery

我在使用正则表达式验证的验证错误消息中使用Tipso工具提示插件,当初次输入无效字符时有效,但是在有效字符之后输入无效字符时,它将显示其默认的空白绿色工具提示。 / p>

示例:

  1. 无效+有效字符(按预期工作)

  1. 有效+无效字符(不起作用-显示其默认的绿色工具提示)

脚本:

$(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');
               }
           });
      });

即使要同时输入有效和无效的字符,我也要显示工具提示。

0 个答案:

没有答案
相关问题