I have a textbox, I need to check if the textbox is empty and set a variable accordingly to true or false.
my code at the moment print the value of the textbox.
var isDateTimEndEmpty = dateTimeEnd.val() == null ? true : false;
what am I doing wrong here?
Here is the correct way:
Good practice is to use
$.trimwhich makes the code to ignore spaces in the input field. So if the length of trimmed value is0then the value is empty.