jquery - How can I get a CKEditor value? -


i have input field in view:

<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'}}%> 

and function in treatments.js file, autocomplete details based on value selected in dropdown select.

var servicedetails = function (){   $('.treatment-service').change(function(){       var service_id = $(this).find('select').val();       debugger       $.ajax({         type: 'get',         url: "/treatment_services/"+service_id,         datatype: 'json',         success: function(data){           debugger         $('.treatment-service').closest('div').next().find('input').val(data.price)         $('.treatment-service').closest('div').next().next().find('input').val(data.unit)         }       })     }); } 

controller:

  def service_details     render json: current_partner.services.find(params[:service_id])   end 

route:

get '/treatment_services/:service_id' => 'treatments#service_details' 

but how can instance value inside ckeditor field? thanks!

not sure understand fully, can value of ckeditor instance via:

ckeditor.instances['div_id'].getdata() // div id without # 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -