使用bootstrap-tagsinputs插件我想在加载视图时为文本框指定值。
传递给视图的值格式为“a,b,c”
这有效
@Html.TextBoxFor(model => model.mylist, new {@class = "form-control"})
但是当我添加data_role =“tagsinput”时,它不起作用
@Html.TextBoxFor(model => model.mylist, new {@class = "form-control", data_role = "tagsinput" })
也尝试过,但没有运气
$(function () {
var elt = $("#mylisttags-input");
elt.tagsinput({
itemText: "@Model.mylist"
});
});
如何配置以便在文本框中显示?
谢谢,
答案 0 :(得分:0)
试试吧,
@Html.TextBoxFor(model => model.mylist, new {@class = "form-control", data_role = "tagsinput" })
$("#mylisttags-input").tagsinput('items'); // to show just pass the items key