contenteditable change events

前端 未结 19 2339
粉色の甜心
粉色の甜心 2020-11-22 01:36

I want to run a function when a user edits the content of a div with contenteditable attribute. What\'s the equivalent of an onchange

19条回答
  •  逝去的感伤
    2020-11-22 01:49

    The onchange event doesn't fires when an element with the contentEditable attribute is changed, a suggested approach could be to add a button, to "save" the edition.

    Check this plugin which handles the issue in that way:

    • Creating a quick and dirty jQuery contentEditable Plugin

提交回复
热议问题