我有一个Telerik编辑器(Asp.net Telerik MVC 3),我用它来允许用户添加项目描述。当编辑器出现时,它总是被禁用。在IE上使用开发工具(DOM Explorer)查看它时,我注意到下面这行代码。我无法弄清楚它的来源。
<script type="text/javascript">document.getElementById('BookDescription-value').style.display='none'</script>
为了解决这个问题,我添加了一个JQuery函数,它可以在加载文本编辑器时立即启用它。它工作正常,但工具仍然被禁用。我不能使文本粗体,下划线或使用工具上指定的任何其他选项。我在这里做错了什么?
//Reference to JQuery and stylesheet
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js" type="text/javascript"></script>
//JQuery Function to enable editor
$(function () {
//this line of code enable the editor text
$('#BookDescription-value').css('display', '');
//I tried the lines of code below to enable the editor's tool bar with no luck.
// Looking at the DOM Explorer tool, I don't see anything else that would disabled it.
$('#BookDescription').css('display', '');
$('.t-input').css('display', '');
$('.t-editor-button').css('display', '');
$('.t-widget t-editor t-header').css('display', '');
});
//Editor
@(Html.Telerik().EditorFor(model => model.BookDescription)
.Encode(true)
.HtmlAttributes(new { style = "height:310px;", id = "BookDescription" })
.Tools(tools => tools
.Clear()
.Bold().Italic().Underline().Strikethrough().Subscript().Superscript().Separator()
.FontName().FontSize()
.FontColor().BackColor().Separator()
.JustifyLeft().JustifyCenter().JustifyRight().JustifyFull().Separator()
.InsertUnorderedList().InsertOrderedList().Separator()
.Indent().Outdent().Separator()
)
)