【发布时间】:2010-12-12 21:06:52
【问题描述】:
我正在使用jQuery token input plugin,并希望在添加令牌时更改其行为。
我在原始代码中添加了一个“onAddToken”回调,因此我可以看到何时将令牌添加到输入框,但我不确定如何更改 tokenInput 的 URL 从“ url/to/call”到一个新的 URL,“new/url/to/call”。
this、$this 和 $(this) 似乎不起作用。有什么建议吗?
$("#input").tokenInput("/url/to/call", {
noResultsText: "No results yet. Type some more...",
searchingText: "Searching...",
onAddToken: function(args) {
// alter tokenInput itself to use "new/url/to/call" instead of
// the original "url/to/call/"
}
});
【问题讨论】:
标签: jquery jquery-plugins jquery-callback jquery-chaining