1, the html page has the following text:
& ltinput id = " groupid text " type = " text " style = " width: 100 px;" maxlength="6" />& lt/TD & gt;
2. The script for limiting the maximum input length with js is as follows:
$ (function)
$('#groupidtext ')。 Open? {'Input', function (e)? }?
If(this.value.length === 6) {// If the input length is equal to 6, the input is disabled}?
$('input[type="submit"]')。 prop('disabled ',false);
Or what?
$('input[type="submit"]')。 prop('disabled ',true);
Js limits the length of text box input to 18 characters, only numbers and letters. If you enter more than 18 characters, you can't enter any more.
This can be achieved by using the maxlength property of the input text label without JS. ? The code is as follows:
& lt input? type="text "? maxlength=" 18 "? /& gt;
Just set the maximum length of the field to be restricted after the maxlength attribute.