如何获取jQuery标签输入插件的值

Khe*_*ine 4 jquery-plugins

我使用这个jQuery标签输入插件:

jQuery标签输入

但我无法获取我的PHP文件的值.

Aus*_*oyd 7

如果您尝试使用jQuery获取单个值,您可以使用:(这假设您在标记输入中输入的文本输入的id为"keywords")

$('#keywords').tagsInput({  
    'height':'auto',  
    'width':'350px',
    'defaultText':'',
    'delimiter': '|'
});
/*The delimiter option above overrides the default comma delimiter in the plugin allowing commas in tags if you prefer that...*/

var $keywords = $("#keywords").siblings(".tagsinput").children(".tag");  
var tags = [];  
for (var i = $keywords.length; i--;) {  
    tags.push($($keywords[i]).text().substring(0, $($keywords[i]).text().length -  1).trim());  
}  

/*Then if you only want the unique tags entered:*/  
var uniqueTags = $.unique(tags);  
alert(uniqueTags.toSource());
Run Code Online (Sandbox Code Playgroud)


Fat*_*orm 0

您能提供一个 POST 内容的示例吗?您可以通过将表单指向 api.fatherstorm.com?query 并复制它为您提供的 json 数据来完成此操作