Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript CKEditor-无法设置属性值';目录';:对象为null或未定义_Javascript_Jquery_Asp.net Mvc 4_Ckeditor_Fckeditor - Fatal编程技术网

Javascript CKEditor-无法设置属性值';目录';:对象为null或未定义

Javascript CKEditor-无法设置属性值';目录';:对象为null或未定义,javascript,jquery,asp.net-mvc-4,ckeditor,fckeditor,Javascript,Jquery,Asp.net Mvc 4,Ckeditor,Fckeditor,我已经下载了CKEditor并在我们的MVC项目中使用。请参考下面的代码 @{ Html.BeginForm("Save", "News", FormMethod.Post, new {@class="form-inline news-admin"}); } <div class="input">@Html.TextBoxFor(x => x.ShortText, new { @class = "shorttext", @id="editor1",maxlength = "

我已经下载了CKEditor并在我们的MVC项目中使用。请参考下面的代码

@{ Html.BeginForm("Save", "News", FormMethod.Post, new {@class="form-inline news-admin"}); }

 <div class="input">@Html.TextBoxFor(x => x.ShortText, new { @class = "shorttext", @id="editor1",maxlength = "50" })</div>

@{ Html.EndForm(); }
@{Html.BeginForm(“保存”,“新闻”,FormMethod.Post,新的{@class=“form inline News admin”});}
@Html.TextBoxFor(x=>x.ShortText,新的{@class=“ShortText”,@id=“editor1”,maxlength=“50”})
@{Html.EndForm();}
编辑代码:

<script type="text/javascript">
                CKEDITOR.replace( 'editor1' );
            </script>

CKEDITOR.replace('editor1');

但它会引发类似无法设置属性“dir”的值的错误:对象为null或在ckeditor.js中未定义。我不知道这个问题的真正原因是什么?我的代码出了什么问题?

两件事。不能覆盖for帮助器上字段的id。因此,你的选择器永远不会抓住这个领域。如果您试图初始化编辑器,则说明您使用的代码不正确。试试这个

$('.shorttext').ckeditor();
<>我们在中间传递一些参数,但是我不确定你的需求是什么。要通过他们,看起来是这样的

$('.shorttext').ckeditor({
    resize_enabled: false,
    toolbarCanCollapse: false, 
    etc...
});

谢谢事实上,问题是,我没有将整个ckeditor文件夹包含到我们的项目中。只添加了脚本,因为它抛出错误,你能建议我哪些项目是必要的,包括在该项目?无论是整个ckeditor文件夹还是仅必需的文件。我可以知道ckeditor所需的文件deatils吗?我们有ckeditor/ckeditor.js和ckeditor/adapters/jquery.js的参考资料。是的,我们可以参考这两个脚本。但是我们需要将ckeditor文件夹添加到项目解决方案中,然后它才起作用。所以我需要在项目中添加ckeditor中的哪些文件(我不要求参考).我相信我是通过nuget安装的。文件夹中有大量文件。我们只提到了我们参考的2个文件。我不知道那些参考资料用的是什么文件。