I want to check whether the password textbox is empty or not? Sometimes user may input only blank spaces by pressing spacebar key. Therefore the code txtPwd.value == '' will not be true. So I guess, I will have to use trim() and then i will have to use the code txtPwd.value == '' and then it becomes true. But trim() didn't work for me. So can anyone help me out by giving the full code?