i have function in separate file, , loads when javascript function called. need in order reach "word_number" id javascript text editor implements. editor loads , call function."
function wordschange() { if (window.addeventlistener) { document.getelementbyid('word_number').addeventlistener('change', wordsk, false); } else { document.getelementbyid('word_number').attachevent('onchange', wordsk); }} function wordsk(){ alert('im reading');} the wordschange function gets called, dont trigger wordsk function. dont know im doing bad, , appreciate suggestions.
sorry lack of information. im trying use output docksoft_stat plugin ckeditor shows word counter on bottom. need info operate with. thank all quick answers.
assumption: using <textarea>. according https://developer.mozilla.org/en-us/docs/web/events/change change-event not fired when type in <textarea>-field. fired when click somewhere else <textarea>.
as jrath suggested, use keydown-event instead. 1 fired each time key has been pressed while textare-element has focus.
using keyup event may not work. possible situation: focus textarea clicking in it, press key (keydown fired), click somewhere outside textarea while still holding key, releasing key. keyup event not fired since textarea field has lost focus clicking somewhere else.
Comments
Post a Comment