Use $('textarea').val('')
.
The problem with using
$('textarea').text('')
, or
$('textarea').html('')
for that matter is that it will only erase what was in the original DOM sent by the server. If a user clears it and then enters new input, the clear button will no longer work. Using .val('')
handles the user input case properly.