Javascript String Empty Check
What’s the best way to check for an empty string in Javascript?
If you just want to check whether there’s any value, you can do
if(!parameter){ //if id is empty, do something }
Here is an example using JQuery to select an element with id name of id.
if(!$("#id").val()){ //if id is empty //be careful about the "!" sign }
You may also like:
Leave a comment