繁体   English   中英

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

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

我正在使用工具提示器在网站上放置样式,但是我尝试使用此代码来检查文本框是否为空,但无法正常工作。 谁能帮我?

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(工具提示)

    <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>

删除return(false); ,如果在以下情况下成功在第一个中成功初始化工具提示,则会导致函数结束: https : //jsfiddle.net/LyaevuLn/2/

暂无
暂无

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

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