Im trying to alert whatever text is in a textarea (id=”status_update”) when the user hits enter:
<script type='text/javascript'>
$(document).ready(function(){
$('textarea').keypress(function(e) {
if(e.which == 13) {
var entry = $('#status_update').val;
alert(entry);
}
});
});
</script>
Alert bubble pops up when the user hits enter but the text says ‘undefined’. I think there is some issue with the way I am trying to define the var entry but Im not sure what the issue is.
Try
$('#status_update').val()