You need to read the contents of the text area again and set it to the response variable in the send event before using it.
var response=""; $('#submit').on('click', function(e) { response = $('#textarea').val(); alert(response); e.preventDefault(); });
Here is the working jsFiddle
Or you need to set the value of the response variable in the keyup event in the text area.
$(document).on("keyup","#textarea",function() { var text_length = $('#textarea').val().length; var text_remaining = nameFormLimit - text_length; $('#textarea_feedback').html(text_remaining + ' characters remaining'); response = $('#textarea').val(); });
With this change, you do not need to read it in the send event.
Here is a working model for this.
source share