Why don't you try for the
event. You don't even need to read the last character and concatenate it.
event is a combination of
event. Below is the sample code to test the response when the
Test KeyPress event:
<input type="text" id="fname1" onkeypress="upperCase(this.id)" />
Test KeyUp Event:
<input type="text" id="fname2" onkeyup="upperCase(this.id)" />
During the test run, you will notice that the last character does not convert to its uppercase during the
event, but it gets converted during the
event does not allow you to handle the control keys like -
SHIFT, ALTER, CONTROL
, while the
events allow you to handle these keys.
Hope I have made my point clear to you.
Thanks & regards,