I use document.getElementById(\"text\").value.length to get the string length through javascript, and mb_strlen($_POST[\'text\']) to get the string
document.getElementById(\"text\").value.length
mb_strlen($_POST[\'text\'])
I have found an mb_strlen equivalent function for Javascript, maybe this might be useful for someone else:
function mb_strlen(str) { var len = 0; for(var i = 0; i < str.length; i++) { len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? 2 : 1; } return len; }
Thanks to all that tried to help!