Link to home
Start Free TrialLog in
Avatar of robert_f
robert_f

asked on

get first characters in form

the script below passes a form entry to a hidden field...

<script language="JavaScript"><!--
function copyData(from,to) { to.value = left(from.value),2; }
//--></script>

how can I get this to copy just the first two characters

ASKER CERTIFIED SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The following link has various JS string functions

http://www.w3schools.com/jsref/jsref_obj_string.asp

You could use

1. substr
2. substring
3. charAt
..
...
Amit