I am making use of trim() like so:
if($(\'#group_field\').val().trim()!=\'\'){
Where group_field is an input element of type t
group_field
Try this instead:
if($.trim($('#group_field').val()) != ''){
More Info: