【发布时间】:2015-07-29 10:04:26
【问题描述】:
我在 asp.net MVC 中创建了一个 webapp,我集成了 bootstrap 3 和 Bootstrap-TagsInput 以对我的数据进行可视化格式化。但是 tagsInput 在 IE 中不起作用。 我在 ie 中测试了 tagsinput 的示例 page 并且工作得很好。 在我的代码剃刀和 jquery 实现下方,用于在我的标签对象中添加 data-role="tagsinput" 属性
<div class="form-group">
@Html.LabelFor(x => x.Tag)
@Html.TextBoxFor(x => x.Tag, new { @class = "form-control" })
</div>
JS
$(Document).ready(function () {
$("#Tag").attr('data-role', 'tagsinput');
});
在IE下的渲染代码:
<div class="form-group">
<label for="Tag">Tag: </label>
<input name="Tag" class="form-control" id="Tag" type="text" value="" data-role="tagsinput">
</div>
我在同一个项目中有引导表,这可能是问题吗?
【问题讨论】:
-
当你拒绝编辑时,请解释这个问题与 MVC 的概念有什么关系。
-
因为如果我使用 html 标签 Bootstrap-tagsinput 确实有效,但使用 razor 无效,我不明白为什么
-
为什么不在razor中直接添加data-role='tagsinput'呢?
new { @class = "form-control", data-role="tagsinput" }。您可以使用字典来构建 htmlAttributes -
如果您在 htmlAtrribute 中遇到破折号登录问题,请使用 AnonymousObjectToHtmlAttributes 助手
标签: c# jquery asp.net-mvc twitter-bootstrap razor