justinbriggs1 Posted November 18, 2008 Share Posted November 18, 2008 Hey everyone, I had a quick question regarding JavaScript.I want to write an if statement to check and see if my input box is empty, like this:if (input.value != null){Validate the input}How do you describe "null" or empty in JS? Thanks,JW Link to comment Share on other sites More sharing options...
justinbriggs1 Posted November 18, 2008 Author Share Posted November 18, 2008 Hey everyone, I had a quick question regarding JavaScript.I want to write an if statement to check and see if my input box is empty, like this:if (input.value != null){Validate the input}How do you describe "null" or empty in JS? Thanks,JWNevermind, I got it! Link to comment Share on other sites More sharing options...
Ingolme Posted November 18, 2008 Share Posted November 18, 2008 Just check the length property to see if it's greater than zero. // Make sure you define the "input" variable correctlyif(input.value.length > 0) { // Validate the input} Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.