I want to limit the number of characters from 3 to 10 in an input form. How can I manage it using Javascript. I need to do it with Javascript so I can change the input field border color from black to red when user's input doesn't meet the requirements. Here is my HTML code. I have tried some variants but got into a mess. Please provide me with the simple solution. Thanks beforehand.
<form action="/index" method="POST">
<input type="text" id="firstname" name="firstname" placeholder="First name">
<br>
<input type="text" id="lastname" name="lastname" placeholder="Last name">
</form>