The handler is not working as expected. How can I fix to make it work? [closed]

I need to make the empty field in a form turn red and pop up an alert when user does not fill it out. I did everything like the instruction, but nothing happens. I dont know if there is something wrong with my function in js or something else. I appreciate if anyone can help!