javascript - jQuery Text Editor (jqte), using change event -


i trying write code change() event using jquery text editor (jqte), have 2 functions give jqte functionality textarea's

one editors loaded javascript, when clicking elements in page

function onloadeditor(){     jquery(".comment-editor").jqte({         // jqte params, such fsize: false,indent: false...         change: function(){ observeeditor(); }     }); } 

and other, generic function, pages 1 single editor

jquery(function() {     jquery(".comment-editor").jqte({         // jqte params, such fsize: false,indent: false...         change: function(){ observeeditor(); }     }); }); 

i want access id of concrete textarea (all textareas in page have id) has fired change() event

how should write observeeditor() function achieve this? or... how should define function in jqte change property?

after reading jquery blur event id , value have solved it, following code (simplified)

function onloadeditor(){     jquery(".comment-editor").each(function(idx, elem) {         jquery(this).jqte({             // jqte params, such fsize: false,indent: false...             change: observeeditor(elem.id),     }); }  jquery(function() {     onloadeditor(); }); 

but have problem...

as can read in original question, onloadeditor() called when clicking elements in page. javascript function jscomment() called, builds form (with textarea.comment-editor field included) , rendered way

function jscomment(){     ...     var form = '<div class="comments_wrapper ... ';     jquery(form).insertafter(some_element).fadein('fast');     onloadeditor(); } 

problem change() event being fired once, when form fades in, while idea opposite, event should fire when user adds text, not when appearing... tips?

update after reading event binding on dynamically created elements? have solved way

function onloadeditor(){     jquery('.comment-editor').each(function(idx, elem) {         jquery(this).jqte({             // jqte params, such fsize: false,indent: false...         });         jquery(document).on('change',              jquery('.comment-editor'),              function(){                  observeeditor(elem.id);              }         );     }); }  jquery(function() {     onloadeditor(); }); 

although not using change() event, being fired constantly. performing better keyup() & paste(), instance


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -