Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 412
  • Last Modified:

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

0
robert_f
Asked:
robert_f
1 Solution
 
RoonaanCommented:
from.value.substring(0,2);

-r-
0
 
Sys_ProgCommented:
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
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now