-1

I am trying to check if the number input element is empty using jquery

<input type="number" name="year" id="year" min="1900" max="2017">
Danielle
  • 89
  • 3
  • 9

1 Answers1

2

Here is an example:

if($("#year").val() == "" || $("#year").val() == null){
    //code goes here
}

You just have to target the element by ID, get its value and check if its an empty string or null.

Hope this helps!

N. Ivanov
  • 1,795
  • 2
  • 15
  • 28