How to put a static message into an HTML form if the field is empty?
05:50 17 Sep 2022

What if I want to check if the field is empty?

If the field is empty I want to send/append a static message like "Hello guys" which is e.target.value.

If I do a check (if the e.target.value == null), nothing happens.

What I want to do is:

if (e.target.value == "") {
   e.target.value = "This is a default message"
}

javascript html css forms