I can easily get the last line in a div by using;
var last_line = $canvas
.contents()
.filter(function () {
return !!$.trim(this.innerHTML || this.data);
})
.last();
alert(last_line.text());
Now I want to replace the last line only. The text within the div will become quite lengthy over time and I don't want to replace the whole div contents each time, just the last line.