When creating an HTML input element, the maxlength attribute can be used to limit the number of characters that can be in it.

<label for="Textbox">Max Length of this element is 10 characters</label>  
<input type="text" id="Textbox" name="Textbox" maxlength="10" />  

Working Example