I am using this function to limit characters in a textarea
. Works well on all browsers minus IE10
(refuse to test on anything lower).
This part $(target).text(num - len);
places the actual number into the textarea, not the limit.
Can anyone point to a fix for IE10 please, im just not that versed with microsoft products. thank you
function countChar(val, target, num){
var len = val.value.length;
if (len >= num) {
val.value = val.value.substring(0, num);
$(target).text(0);
}else {
$(target).text(num - len);
}
};
here is my fiddle: http://jsfiddle.net/nalagg/uFDhZ/
on fiddle IE is not responding to the limit
edit reversing order seems to have fixed it:
$(target).text(0);
val.value = val.value.substring(0, num);