mdbootstrap / bootstrap-templates

A collection of free Bootstrap 5 templates.
https://mdbootstrap.com/freebies/
3.07k stars 1.02k forks source link

InputSize recommended use of real character lengths #618

Closed Lost-FFRL closed 2 years ago

Lost-FFRL commented 6 years ago

inputSize = Math.max(1, this.placeholderText.length); Math.max(this.inputSize, $input.val().length); Chinese characters is 2 length,placeholderText not fully displayed。 function() {
var len = 0;
for (var i=0; i<this.length; i++) { if ((this.charCodeAt(i) & 0xff00) != 0){ len ++; } len ++;
} return len;
}