Jquery check input trim

1k Views Asked by At

How can i create a custom function in jquery?

I want to use that on text inputs, to check with trim, that the user really entered some text, or just white spaces.

1

There are 1 best solutions below

3
Hamed Javaheri On BEST ANSWER

You can use .trim() function.

if ($.trim($("input-selector").val()))
{
   //do Something
}