[英]how can I use the id of textbox with ckeditor (using with ajax)
I have used the CKEditor for my textbox styling .i have done to add in my textbox but if I want to get my id from the textbox then it gives the undefined value .
我已经将 CKEditor 用于我的文本框样式。我已经在我的文本框中添加了,但是如果我想从文本框中获取我的 ID,那么它会给出未定义的值。 Anyone can help me to resolve my query it would be helpful for me.
任何人都可以帮助我解决我的查询,这对我有帮助。
<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>
Your code looks fine.你的代码看起来不错。 Just verify below points:
只需验证以下几点:
jquery.js
and ckeditor.js
before you are using them, preferably in the <head>
jquery.js
和ckeditor.js
,最好在<head>
id
is the same as in your JS id
与您的 JS 中的相同If so, are you missing any other details which might be relevant?如果是这样,您是否遗漏了任何其他可能相关的细节?
Check out:查看:
$(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.