I have a JavaScript function that counts the number of characters in some text area. My function is as follows..
function limiting(obj) {
var count = $("#counter > span");
var txt = $(obj).val();
var length = txt.length;
$(cnt).html(length);
}
I call this function every time someone types in text area and it works. Now I want this function to act as:
- Detect arabic characters
- Add 2 to the count for each Arabic character
- Add 1 to the count for each English character
for example if we have 2 Arabic and 3 English characters then the count should be 7, currently it is 5. I have googled it but could not find anything clear. Thanks