You can use text box maxlength
property.
<input type="text" name="txtBlkAccountId" maxlength="20">
OR
You can use JS:
$("#txtBlkAccountId").on('keypress',function(){
if($(this).val().length>20){
alert("error message");
return false;
}
});