instance - CKEditor and keypress event -


i have simple page has 2 input text fields , 1 textarea field. have been working associating keypress event these 3 form fields. have changed textarea rich editor using ckeditor. used ckeditor.js, adapters/jquery.js, , other relevant files ckeditor. keypress event associated textarea fails. here part of code i'm working with.

..... <input type="text" id="sub" name="subject" autocomplete="off"> <input type="text" id="rec" name="recvr" autocomplete="off">   <textarea  cols="90" rows="18"  name="body" id="content" >  </textarea>  ... 

and in jquery, have following create ckeditor instance , associate keypress event form fields:

....  if(ckeditor.instances['body']){     delete ckeditor.instances['body'];  }  ckeditor.replace('body');  /*translate letters on key press */ $("input#sub").keypress(function(event){   //alert(this.form);   translateonkeypress(event, this.form); }); /*$("textarea#body").keypress(function(event){      // alert(this.form);      translateonkeypress(event, this.form); }); */  ckeditor.instances['body'].on('instanceready', function() {       this.document.on('keypress', function(event){           alert(event + ">> " + this.form + " <<< ");           translateonkeypress(event, this.form);       });  }); .... 

so, problem this.form in ckeditor instance @ last returns undefined , translateonkeypress(event, this.form) stops working. other text fields work perfectly. so, problem seems on handling form event function. can give me hand here? highly appreciated.

thanks,

this should give jquery object represents parent form of textarea.

    ckeditor.instances['body'].on('instanceready', function (e) {         this.document.on('keypress', function (event) {             var form = $("#" + e.editor.name).closest("form");             translateonkeypress(event, form[0]);         });     }); 

(tested using ck editor 4.2)


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -