Skip to content

Instantly share code, notes, and snippets.

@karlgroves
Created November 19, 2013 12:18
Show Gist options
  • Save karlgroves/7544535 to your computer and use it in GitHub Desktop.
Save karlgroves/7544535 to your computer and use it in GitHub Desktop.
jQuery empty() doesn't tell you if something is blank, it tells you whether something is truly empty - having no other nodes inside it. This function tells whether a string is blank. It returns true in cases where there are no printable text characters are in the string.
function isBlank(str){
return str.replace(/\W/gi, '') == '';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment