繁体   English   中英

jQuery插件停止占位符出现

[英]Jquery plugin stops placeholder to appear

好的,所以我有一个jquery标签插件,可以很好地工作,但是后来我想起来,在我的文本框中添加一个“占位符”会很酷。 我这样做了……除了jquery插件外什么都没有出现……我的占位符应该是“ hello type here”……我猜它不起作用,因为该插件位于“ script”标签之间...如果有人可以帮助我,我将非常感激:)

<html>
    <head>
        <script src="jquery-1.11.1.min.js"></script>
        <script src="jquery-ui.js" type="text/javascript" charset="utf-8"></script>
        <script src="tag-it.js" type="text/javascript" charset="utf-8"></script>
        <link href="jquery.tagit.css" rel="stylesheet" type="text/css">
        <link href="style.css" rel="stylesheet" type="text/css">
    </head>

    <body>
        <form name="myForm" action="searchlevel.html" method="post">
            <p id="text">Sport:</p>
            <input type="text" name="query" id="box" placeholder="hello type here! ">
            <input type="submit" value="Submit" id="but">
        </form>
    </body>
    <script>
        //this is jquery tag plugin...  

        $(document).ready(function () {
            $("#box").tagit();

        });

        // I guess I have to add something here to display the "placeholder", please help.
    </script>
</html>

阿罗哈,你的伴侣!

为什么要使用tagit javascript和CSS作为占位符。 删除该脚本并简单地使用它就可以了,但是记住它唯一的创建问题是在IE <9中使用它

看看这里可能对您有帮助

JSFiddle 测试在这里

暂无
暂无

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

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