PDA

Click to See Complete Forum and Search --> : charAt


richy
Feb 15th, 2001, 08:25 AM
Can anybody tell me what is wrong with the following code. I found out about the charAt function from the webreference website (http://webreference.com/js/tips/000227.html) but I keep getting the output as undefined.
The first alert responds with the correct value, but on the second alert that's when I get the undefined.


alert(s.value);
var tmpstring=s.value;
alert(tmpstring.charAt[2]);

Mark Sreeves
Feb 15th, 2001, 08:47 AM
you should have round brackets for chatAt


alert(tmpstring.charAt(2));

richy
Feb 15th, 2001, 09:22 AM
the simplest of things....

cheers very much that worked.