javascript - contenteditable change events -


i want run function when user edits content of div contenteditable attribute. what's equivalent of onchange event?

i'm using jquery solutions uses jquery preferred. thanks!

i'd suggest attaching listeners key events fired editable element, though need aware keydown , keypress events fired before content changed. won't cover every possible means of changing content: user can use cut, copy , paste edit or context browser menus, may want handle cut copy , paste events too. also, user can drop text or other content, there more events there (mouseup, example). may want poll element's contents fallback.

update 29 october 2014

the html5 input event answer in long term. @ time of writing, supported contenteditable elements in current mozilla (from firefox 14) , webkit/blink browsers, not ie.

demo: http://jsfiddle.net/ch6yn/


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -