我正在使用Kendo UI MVC Wrappers,我有这样的代码:
@(Html.Kendo().DropDownList()
.Name("MyField_Something")
)
它会生成一个看起来像这样的 html:
<div class="editor-field">
<span class="k-widget k-dropdown k-header" tabindex="0" style="" unselectable="on">
<script>
jQuery(function(){jQuery("#MyField_Something").kendoDropDownList();});
</script>
<span class="k-invalid-msg" data-for="MyField.Something"></span>
</div>
我的问题是,是否可以在剑道渲染之前更改该 jQuery 脚本的选择器?而不仅仅是id,我希望它的父元素也像这样:
<script>
jQuery(function(){jQuery("#ParentElement #MyField_Something").kendoDropDownList();});
</script>
我怎样才能做到这一点?