17128

Jquery events on CKeditor

Question:

Hello in a form with a textarea with id "ckeditor_input"

$("#ckeditor_input").ckeditor(); $("#ckeditor_input").html(); // can get the value ("#ckeditor_input").click/blur/keydown/keypressed( function(){ alert("OK"); } ); //doesn't work!

the problem is ckeditor! If I don't start an instance of ckeditor on the textarea all events work fine! What is the right way to get events on a ckeditor instance?

Thank you

Answer1:

CKEditor uses an iframe... very annoying for jQuery events. You could try:

$($('#parent-element>iframe').get(0).contentWindow.document).live('click',function() { ... });

I haven't tested it so not entirely sure whether it'll work. But I'm sure that's the starting point for the solution. Let me know how it goes, and if it doesn't work I'll try and work out what the problem is.

<strong>Edit::</strong> (based on the comment)

$(CKEDITOR.instances.desc_product).click(function() { ... });

I think that should do it. But only run it after CKEditor has loaded properly.

Recommend

  • HTML editor for iOS [closed]
  • CKEditor and iFrame/YouTube/Other Embed Plugins Show Weird HTML Code
  • CKEDITOR 4: Table cell selection not coming properly on Chrome and IE
  • CKEditor separate the toolbar from the editor
  • Javascript Array, Object, Date not defined
  • Is there a way to dynamically embed PDF Files in a JSP pulled from the file system?
  • Can someone please explain to me in the most layman terms how to use EventArgs?
  • How to use JavaScript to determine whether a file exists in a directory?
  • Detect when Facebook like button is clicked
  • how to display data from 1st point on words on y axis for line chart in d3.js
  • Functions in global context
  • Row Count Is Returning the incorrect number using RaptureXML
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • Highlight one bar in a series in highcharts?
  • FileReader+canvas image loading problem
  • Sony Xperia Z Tablet not found by adb
  • How to recover from a Spring Social ExpiredAuthorizationException
  • WinForms: two way TextBox problem
  • Join two tables and save into third-sql
  • How to model a transition system with SPIN
  • ORA-29908: missing primary invocation for ancillary operator
  • How can I estimate amount of memory left with calling System.gc()?
  • R: gsub and capture
  • Calling of Constructors in a Java
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • Compare two NSDates in iPhone
  • Comma separated Values
  • PHP: When would you need the self:: keyword?
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • python regex in pyparsing
  • How to set the response of a form post action to a iframe source?
  • Hits per day in Google Big Query
  • Android Google Maps API OnLocationChanged only called once
  • Reading document lines to the user (python)
  • Binding checkboxes to object values in AngularJs
  • Converting MP3 duration time
  • Net Present Value in Excel for Grouped Recurring CF
  • How can I use threading to 'tick' a timer to be accessed by other threads?
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?