This is a great way to use this plugin.
Issue:
& lt; Input type = "hidden" name = "tag" id = "mySingleField" value = "apple, orange" disabled = "true" & gt; Tags: & lt; Br> & Lt; Ul id = "mytags" & gt; & Lt; / Ul & gt; & Lt; Script type = "text / javascript" & gt; $ {Document} .ready (function () {$ ("# mytags"). Tagit ({singleField: true, singleFieldNode: $ ('# mySingleField'), AllowSpace: true, minnothing: 2, remove sync: correct, tags Source: function (request, response) {//console.log("1 "); $ .ajax ({url:" ..///GetList ", data: {word: request.term}, data type:" Jason ", success: function (data) {response ($ .max (data, function (item) {return {label: item.label +" ("+ item.id +") ", value: item.value}} });}}}}}}}}}; & Lt; / script & gt; tag when it selects the values Prices add value to CSV format in hidden fields in Atit. I want to do this instead of ID?
Here are some things. You can set the parameters to set the delimiter instead of a CSV, such as with an underscore:
$ ("# mytags"). Tagit ({. .. singleFieldDelimiter: '_', ... ... Then you can modify the tag-it.js file on the 1997 line to use the ID-attributeMay include.
Replace:
var tags = node.val (). Division (this.options.singleFieldDelimiter); be
var tags = Node.attr ("id"). Division (this.options.singleFieldDelimiter); So we say that you modify the hidden fields:
& lt; Input type = "hidden" name = "tags" class = "mySingleField" id = "Apple_Orange_Banana" value = "Apple_Orange" disabled = "true" & gt; You will modify javascript to get the desired output as:
$ (document) .ready (function () {$ ("# Taget (true: true, singleFieldNode: $ ('.mySingleField'), singleFieldDelimiter: '_', AllowSpace: true, minlanta: 2, remove sync: true, tag source: fu connection (request, response) {//console.log("1 "); $ .ajax ({url:" ../city/GetList ", data: {word: request.term}, datatype:" Jason ", success: function (data) {Response ($ .max (data, function (item) {return {label: i Tem.label + "(" + item.id + ")", value: item.value}}))))}}});}}); });
No comments:
Post a Comment