Filter a database query after 3 or more characters are entered

how can we check for length of the input box string on client side and not call the API itself?