简体   繁体   English

Tooltipster jQuery插件,用于检查空文本框

[英]Tooltipster jQuery plugin to use for checking empty textbox

I am using tooltipser to put style on my website, but I tried this code to check if the textbox is empty but it did not work. 我正在使用工具提示器在网站上放置样式,但是我尝试使用此代码来检查文本框是否为空,但无法正常工作。 can anyone help me? 谁能帮我?

HTML FORM HTML格式

<form name="studentform" method="POST" action="index.php" role="form" onsubmit="return check(this)" autocomplete="off">
    <center>
        <input type="text" name="suid" class="suid" id="suid" placeholder="STUDENT NO." title="Student No. is required">
        <input type="password" name="pass"  id="pass" class="pass" placeholder="PASSWORD" title="Password is required">
        <input type="submit" name="login" class="sub" value="LOG IN">
    </center>
</form>

jQUERY (Tooltipster) jQUERY(工具提示)

    <script>
        function check()
        {
            if (!studentform.suid.value)
            {

                $('.suid').tooltipster({
                animation: 'grow',
                delay: 200,
                theme: 'tooltipster-default',
                touchDevices: true,
                trigger: 'hover',
                position: 'right'
                });return (false);

            }
            if (!studentform.pass.value)
            {
                $('.pass').tooltipster({
                animation: 'grow',
                delay: 200,
                theme: 'tooltipster-default',
                touchDevices: true,
                trigger: 'hover',
                position: 'right'
                });
                return (false);
            }
            else {return true;}
        }
</script>

Remove return(false); 删除return(false); , it's causing the function to end after successfully initializing tooltipster in the first if: https://jsfiddle.net/LyaevuLn/2/ ,如果在以下情况下成功在第一个中成功初始化工具提示,则会导致函数结束: https : //jsfiddle.net/LyaevuLn/2/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM