Is there a JavaScript equivalent to .NET's String.IsNullOrWhitespace
so that I can check if a textbox on the client-side has any visible text in it?
I'd rather do this on the client-side first than post back the textbox value and rely only on server-side validation, even though I will do that as well.
It's easy enough to roll your own:
function isNullOrWhitespace( input ) {
if (typeof input === 'undefined' || input == null) return true;
return input.replace(/\s/g, '').length < 1;
}