Hi,
I am trying to create user interface dynamically, a series of textboxes with tag-it or autocomplete. And I want to call tagit() or autocomplete(). For tag-it plugin i might be able to make it work only on the last element. and for autocomplete i could not make it work. here is the part where i try to create a series of textboxes with tagit:
- publicMethod.addAutoCompleteTags = function(params){
- $divDOM = $('<div></div>');
- $divDOM.attr("id", "content1");
-
- $formDOM = $('<form></form>');
- $formDOM.attr("class", "myform1");
-
- $divLineDOM = $('<div></div>');
- $divLineDOM.attr("class", "line1");
- $divLineDOM.append("<label for='tag_" + params.id + "' >Tags</label>");
- $divLineDOM.append("<input type='text' itemName='tagBox' id='tag_" + params.id + "' />");
-
- $formDOM.append($divLineDOM);
- $divDOM.append($formDOM);
-
- li = $('<li></li>');
- li.append($divDOM);
-
- this.parent.append(li);
-
- var availableTags = [
- "ActionScript",
- "AppleScript",
- "Asp",
- "BASIC",
- "C",
- "C++",
- "Clojure",
- "COBOL",
- "ColdFusion",
- "Erlang",
- "Fortran",
- "Groovy",
- "Haskell",
- "Java",
- "JavaScript",
- "Lisp",
- "Perl",
- "PHP",
- "Python",
- "Ruby",
- "Scala",
- "Scheme"
- ];
-
- $("#tag_" + params.id + "").autocomplete({
- source : availableTags
- });
-
- };
and here is the part where i try to create fields with tag-it property:
- publicMethod.addAutoCompleteTags = function(params){
- $divDOM = $('<div></div>');
- $divDOM.attr("id", "content1");
-
- $formDOM = $('<form></form>');
- $formDOM.attr("class", "myform1");
-
- $divLineDOM = $('<div></div>');
- $divLineDOM.attr("class", "line1");
- $divLineDOM.append("<label for='tag_" + params.id + "' >Tags</label>");
- $divLineDOM.append("<ul itemName='tagBox' id='tag_" + params.id + "' ></ul>");
-
- $formDOM.append($divLineDOM);
- $divDOM.append($formDOM);
-
- li = $('<li></li>');
- li.append($divDOM);
-
- this.parent.append(li);
-
- var availableTags = [
- "ActionScript",
- "AppleScript",
- "Asp",
- "BASIC",
- "C",
- "C++",
- "Clojure",
- "COBOL",
- "ColdFusion",
- "Erlang",
- "Fortran",
- "Groovy",
- "Haskell",
- "Java",
- "JavaScript",
- "Lisp",
- "Perl",
- "PHP",
- "Python",
- "Ruby",
- "Scala",
- "Scheme"
- ];
-
- $("#tag_" + params.id + "").autocomplete({
- source : availableTags
- });
-
-
- };
Any help wil be appreciated. Thank you for now