I'm having problem with counting some special characters on textarea

every time I press alt+164 for example , it does not count the character unless I press another key.

heres my code:

HTML

<textarea style="resize:none;" rows="15" name="tarea" cols="45" 
onkeyup="count_chars(this);"
onkeydown="count_chars(this);"
onkeypress="count_chars(this);"></textarea>

Javascript:

function count_chars(tarea)
	{
		x = document.myform.tarea.value;
		document.myform.charcount.value = x.length;
	}

I tried using onkeydown, onkeypress, even onmouseup and onmousedown but still it needs to press any key after entering a alt combo code

after 10 hours .... still no reply

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.