Skip to content

Instantly share code, notes, and snippets.

@dpsk
Created February 10, 2012 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpsk/1787432 to your computer and use it in GitHub Desktop.
Save dpsk/1787432 to your computer and use it in GitHub Desktop.
contenteditable change event emulation
$ ->
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment