CKEditor未显示在JS文件中

CKEditor未显示在JS文件中,ckeditor,Ckeditor,我想将textarea显示为CKEditor,但它在这里不起作用,尽管它在我的html代码中起作用 我有一个文件global.js,它也作为脚本包含在我的html代码中 这是我在global.js中的函数 $(document).ready(function() { $("a#reply").one("click" , function() { var comCode = $(this).attr("name"); var parent = $(this).parent();

我想将textarea显示为CKEditor,但它在这里不起作用,尽管它在我的html代码中起作用

我有一个文件global.js,它也作为脚本包含在我的html代码中

这是我在global.js中的函数

$(document).ready(function() {
$("a#reply").one("click" , function() {
    var comCode = $(this).attr("name");
    var parent = $(this).parent();
    parent.append("<br /><form action='index.php' method='post'><input 
       type='text' name='uname2' id='uname2' placeholder='Enter username' 
       required /><textarea class='ckeditor' name='editor' 
       placeholder='Enter your query' id='new-reply' required></textarea>
       <input type='hidden' name='code' value='"+comCode+"' /><input 
       type='submit' class='form-submit' id='form-reply' name='new_reply' 
       value='Reply' /></form>")
       //$(".chreply").toggle();
    });
 })
我做错什么了吗?这是我的代码有问题吗?还是说ckeditor从未在js文件中显示?

可能仅用于DOM元素、元素ID或元素名称。从我在代码中看到的情况来看,您尝试将其与类名一起使用。因此,在这个简短的示例中,您应该使用如下代码:

CKEDITOR.replace( 'new-reply' )
最有可能的是控制台中有一个错误,通知无法找到,
ckeditor
或类似的内容。

它通过添加

parent.append("<br /><form action='index.php' method='post' id='tog'><input 
type='text' name='uname2' id='uname2' placeholder='Name' required /><textarea 
name='editor' placeholder='Query' id='new-reply' required>
</textarea><input type='hidden' name='code' value='"+comCode+"' /><input 
type='submit' class='form-submit' id='form-reply' name='new_reply' 
value='Reply' /><script>CKEDITOR.replace('new-reply');</script></form>") 
parent.append(
CKEDITOR.replace('new-reply');“”)
如果您在移动电话上发帖,请找到您的Shift键,或切换到PC或笔记本电脑。志愿编辑愿意帮助使文章更具可读性,但我们不是你的自动更正。出于同样的原因,请不要使用txtspk,谢谢!请阅读-总结是,这不是一个理想的方式来解决志愿者,可能会适得其反获得答案。请不要将此添加到您的问题中。另外,不要写“plzz帮助很紧急”。这被认为是非常粗鲁的。你在向没有报酬的人寻求帮助。
parent.append("<br /><form action='index.php' method='post' id='tog'><input 
type='text' name='uname2' id='uname2' placeholder='Name' required /><textarea 
name='editor' placeholder='Query' id='new-reply' required>
</textarea><input type='hidden' name='code' value='"+comCode+"' /><input 
type='submit' class='form-submit' id='form-reply' name='new_reply' 
value='Reply' /><script>CKEDITOR.replace('new-reply');</script></form>")