I try to limit a form of input to 10 chars
var max_chars = 10;
$('input#ctl00$bc$custom_element_44').keydown( function(e){
if ($(this).val().length >= max_chars) {
$(this).val($(this).val().substr(0, max_chars));
}
});
$('input#ctl00$bc$custom_element_44').keyup( function(e){
if ($(this).val().length >= max_chars) {
$(this).val($(this).val().substr(0, max_chars));
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<input name="ctl00$bc$custom_element_44" type="text" id="ctl00_bc_custom_element_44">
But it does not seem to work, advice is sought;)
Regards Pete