Frage

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);
});
War es hilfreich?

Lösung

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()); 
    });
});
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top