Skip to content

Instantly share code, notes, and snippets.

@laktek
laktek / jquery.is_blank.js
Created December 29, 2010 06:38
Checks whether the given string (or object) is blank
(function($){
$.isBlank = function(string){
return(!string || $.trim(string) === "");
};
})(jQuery);
$.isBlank(" ") //true
$.isBlank("") //true
$.isBlank("\n") //true
$.isBlank("a") //false