无法从 Jquery TAGIT 获取标签列表
你好,我正在使用 java play 框架,我想在我的项目中实现 JQuery Tagit。
我正在做与他们网站上写的完全相同的事情,但我无法检索所选值的值。代码如下:
<form id="messageForm">
<script>
$(document).ready(function(){
$("#mytags").tagit({
select:true,
availableTags:function( request, response){
$.ajax({
url: "@{Users.getUserList()}",
dataType: "json",
data: {
term: request.term
},
success: function( data ){
response ($.map( data, function ( item){
return {
label: item.fullName,
value: item.username
}
}));
}
});
}
});
});
</script>
<label for="mytags">To:</label>
<ul id="mytags" name="selectedTags"></ul>
</form>
我可以成功地用 json 元素填充列表,我对此没有任何问题。但不知怎的,我无法设法从中检索输入的标签。
我试过
document.getElementByID("messageform").selectedTags
但我认为我做错了。
hi there i am woring with java play framework and i want to implement JQuery Tagit in my project.
I am doing exactly the same thing written in their site but i cant manage to retrieve the values of selected values. heres the code:
<form id="messageForm">
<script>
$(document).ready(function(){
$("#mytags").tagit({
select:true,
availableTags:function( request, response){
$.ajax({
url: "@{Users.getUserList()}",
dataType: "json",
data: {
term: request.term
},
success: function( data ){
response ($.map( data, function ( item){
return {
label: item.fullName,
value: item.username
}
}));
}
});
}
});
});
</script>
<label for="mytags">To:</label>
<ul id="mytags" name="selectedTags"></ul>
</form>
i can succesfully populate the list with json elements, i have no problems with that. but somehow i cant manage to retrieve the entered tags from it.
i tried
document.getElementByID("messageform").selectedTags
but i think im doing it wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后我发现了问题。 Tag-it 插件是一个非常常见的插件,但互联网上有许多由不同程序员编写的不同版本。我正在使用与查看文档不同的 tag-it 模块。所以要小心你正在阅读你正在使用的 tagit 模块的正确文档(抱歉我的语法我知道它很糟糕) –
Finally i found the problem. Tag-it plugin is a quite common plugin but there are lots of different version written by different programmers around the internet. I was working with a different tag-it module than i was looking at the document. So be careful that you are reading the corrent document of the tagit module you are using (sorry for my grammar i know it sucks) –