Javascript/Jquery

Hi There,
it is bit urgent for me could anyone please help me out with this…

My issue is i have 1 textarea and 2 textfields (Name and Last Name) and whatever I enter into textarea I want that to be copied to textfields.
But along with this the input in the textarea will be
Firstname
Lastname
So I want this firstname to be copied to first textfield and lastname to be copied to second textfield and if i enter any data in the third line in textarea then it should go in the third textfield.

Please any urgent response will be appreciated.

Hi Thanks for the reply…
But i am not getting how to use split function
i have given textarea.split(" ");
in the code but dint work can u please help me with the code

obvioulsy you have to split on the line breaks …

Hi,

I guess, this should work for you:

var lines = $(“textarea”).val().split(" “)
$(”#textinput1").val(lines[0])
$(“#textinput2”).val(lines[1])

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.