There is a <input type="text" id="firstTdVal"> .
The user enters data in the field , after which I check it for emptiness. If the field contains spaces, the check does not work correctly. The trim () function has been applied, with which it is necessary to remove extreme spaces (or all spaces, if input contains only them). Tried in 3 ways, all by:
$.trim($('#firstTdVal')); //1. обращаюсь к самому элементу input, думаю, это неверно, т.к. это не строка, а элемент $.trim($('#firstTdVal').val());//2.обращаюсь к содержимому элемента, по-моему, должно работать, но нет $.trim($('#firstTdVal', this).val()); How would I address the line and remove extra spaces?