I'm trying to draw rectangles and capture the coordinates in a textarea. A button is provided to clear the textarea.
Problem 1: The textarea is not cleared (deleted text is still there the next time the textarea is updated).
$("#clearoutput").click(function (e) {
$("#output").empty();
});
I tried .val("")
but that only seems to clear the textarea form. The text is still visible in the html source. Plus it stays cleared, won't allow new entries.
Problem 2: I'm not sure how append works. If I don't put .empty()
on mousedown (ie. start of new drawing), it will append the entire textarea instead of appending the last line. Why is that?
For the code and instructions to reproduce problem 1 see http://jsfiddle.net/dpqm77b7/ (code is adapted from jQuery drag and draw)
Thanks!