0

我试图在最后几天徒劳地实现 jQuery 标签管理器( http://welldonethings.com/tags/manager )......

环境是什么样的:它是一个引导驱动的网站,上面有几个元素,应该能够被标记(在引导模式中)。

到目前为止我所做的:我已将 tagManager 类添加到我的输入字段中。

<form>
   <input type="text" name="tags_0" placeholder="Tags" class="tagManager">
</form>

此外,在我网站的 head 部分中,我包含了一个自定义 javascript 文件:

<script type='text/javascript' src="js/javascript.js"></script>

该文件如下所示:

jQuery(".tagManager").tagsManager();

当然还包括 jQuery 库和 bootstrap & TagsManager css 文件。

但是,当我输入标签时,它会使用 get-variable "?tags_0=test" 重新加载网站

我现在有点沮丧。看起来很简单,但我无法让它工作......

最好的问候,尼科

4

1 回答 1

0

This probabily isn't going to help the original poster since this was asked some time ago, but I was having the exact same problem and when I searched for help I found this question, so my answer might help someone that ends up here with the same problem.

I was trying to use this jQuery plugin as well and I was having a hard time to get it working too. Spent hours checking the code and searching for help but always got to the conclusion that the code was correct, so I had no idea what was wrong. However, somehow, it then started working. One thing I noticed was that if I had the call for the css file first and then the js files, it would show some weird thing in the place where it should have the "x" for deleting the tag. But if I called the js files first and then the css file, it would work perfectly.

This is the code I used:

<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="bootstrap-tagmanager.js"></script>
<link href="bootstrap-tagmanager.css" rel="stylesheet" type="text/css">
</head>
<body>

<input type="text" name="products" placeholder="Add your Products" class="tagManager">

<script>
 jQuery(".tagManager").tagsManager();
</script>

</body>

Hope this helps someone.

于 2013-07-20T22:03:58.043 回答