How to read textarea with certain condition

Posted by user281180 on Stack Overflow See other posts from Stack Overflow or by user281180
Published on 2010-03-15T12:40:05Z Indexed on 2010/03/15 12:49 UTC
Read the original article Hit count: 230

Filed under:

I have a textarea in which the user enters the following data:

  1. Paul:Nine, Rome
  2. Jenny:Five, India
  3. Bob

I want to read the data and store the values before the colon in an array and the values after the colon in another array. Please note that the user may not enter values after the colon like in case 3 above. In such case, the value must be stored in the first array as if it is before the colon.

How can I do that using jquery?

© Stack Overflow or respective owner

Related posts about jQuery