Jquery 如何获取CKEditor值?
我的视图中有此输入字段:Jquery 如何获取CKEditor值?,jquery,ruby-on-rails,ajax,ckeditor,Jquery,Ruby On Rails,Ajax,Ckeditor,我的视图中有此输入字段: <div class="treatment-service"> <%= f.input :service_id, as: :select, collection: current_partner.services.pluck(:name, :id), :label => "Serviciu" %> </div> <%= f.input :description, :as => :ckeditor, :input_
<div class="treatment-service">
<%= f.input :service_id, as: :select, collection: current_partner.services.pluck(:name, :id), :label => "Serviciu" %>
</div>
<%= f.input :description, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Pure'}}%>
控制器:
def service_details
render json: current_partner.services.find(params[:service_id])
end
路线:
get '/treatment_services/:service_id' => 'treatments#service_details'
但是如何从ckeditor字段内部获取实例值呢?
谢谢 我不确定是否完全理解,但您可以通过以下方式获取CKEditor实例的值:
CKEDITOR.instances['div_id'].getData() // the div id without a #
CKEDITOR.instances['div_id'].getData() // the div id without a #