使用 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"
});
});
如何配置使其显示在文本框中?
谢谢,