How do you get the length of a string in jQuery?
You don't need jQuery; you can use the vanilla JavaScript method yourstring.length
. See reference here and also here.
To support Unicode strings, length needs to be computed as following:
[..."𠮷"].length
or create an auxiliary function
function uniLen(s) {
return [...s].length
}