[英]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.