[英]how can I use the id of textbox with ckeditor (using with ajax)
我已经将 CKEditor 用于我的文本框样式。我已经在我的文本框中添加了,但是如果我想从文本框中获取我的 ID,那么它会给出未定义的值。 任何人都可以帮助我解决我的查询,这对我有帮助。
<script src="//cdn.ckeditor.com/4.5.11/standard/ckeditor.js"> </script> <script> CKEDITOR.replace( 'editor1' ); </script> <script> $(document).ready(function(){ var topic_describe=$("#add_val").html(); alert(topic_describe); }); </script>
<textarea name="editor1" id="add_val"></textarea> <br/> <a href='#' class="btn btn-success" style=' padding-top:10px;' id='submit' ><strong><span class='glyphicon glyphicon-pencil'></span> Add Post </strong></a>
你的代码看起来不错。 只需验证以下几点:
jquery.js
和ckeditor.js
,最好在<head>
id
与您的 JS 中的相同如果是这样,您是否遗漏了任何其他可能相关的细节?
查看:
$(document).ready(function() { CKEDITOR.replace('editor1'); var topic_describe = $("#add_val").html(); alert(topic_describe); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdn.ckeditor.com/4.5.11/standard/ckeditor.js"> </script> <textarea name="editor1" id="add_val">************* This is the Text inside the Textarea *************</textarea> <br/> <a href='#' class="btn btn-success" style=' padding-top:10px;' id='submit'><strong><span class='glyphicon glyphicon-pencil'></span> Add Post </strong></a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.