public
Last active

contenteditable change event emulation

  • Download Gist
contenteditable_change.js.coffee
CoffeeScript
1 2 3 4 5 6 7 8 9 10 11 12
$ ->
# contenteditable change event
$("[contenteditable]").live("focus", ->
$this = $(this)
$this.data "before", $this.html()
$this
).live "blur keyup paste", ->
$this = $(this)
if $this.data("before") isnt $this.html()
$this.data "before", $this.html()
$this.trigger "change"
$this

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.