Javascript – How to check if a text is all white space characters in client side

javascriptjquery

How to check if a user input text is all white space characters (space, tab, enter etc) in client side?

Best Answer

This question is tagged with jQuery. In jQuery, you can run the following:

if ( $.trim( $('#myInput').val() ) == '' )
    alert('input is blank');