Pregunta

How can I (with Javascript) get the new content from a contentEditable DOM element on a page. Would it be as simple as using jQuery in such as way:

$("#content").on("keyup", ".editable", function(e){
  var newText = $(this).text();
  console.log("New text is: "+newText);
});
¿Fue útil?

Solución

The solution was simple as I was (admittedly) being lazy and asking on here. Here's my JSFiddle for those in the future to see: http://jsfiddle.net/ysLPq/. See code below:

$(document).ready(function(){
    $(document).on("keyup", ".editable", function(){
        console.log($(this).text()); 
    });
});
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top