here is a really simple example. it assumes your textarea has an id of "textareaid" and your auto fill button has an id of "autofillid"
- side note you should really have a valid form element. having valid html can only help you.
Code:
function getuserdata(){
var $ta= $("#textareaid");
var $data= $ta.val().split('\n');
var $first = $data[0].replace('First Name');
var $last = $data[1].replace('Last Name');
var $post = $data[2].replace('Postcode');
$('#f1').val($.trim($first));
$('#f2').val($.trim($last));
$('#f3').val($.trim($post));
}
});
$("#autofillID").click(function(){
getuserdata();
});
Also, if you wanted to, you can do away with the autofill button and jsut fill the fields automatically upon the paste event like so:
Code:
$("#textareaid").bind('paste',function(){
getuserdata();
});