Let\'s say I have a text field:
Username:
You can check the value of the input field with user.val() and the length of the string with user.val().length.
user.val()
user.val().length
That way you can do something like this:
if(user.val().length < 2 || user.val().length > 5) { console.log('test') }