You don't need to use .html()
. You should go with .val()
.
From the doc of .val()
:
The
.val()
method is primarily used to get the values of form elements such asinput
,select
andtextarea
. When called on an empty collection, it returnsundefined
.
var message = $('#message').val();