The issue seems to be that you are thinking that the second "for" loop
will run after the keypress event is called... *it's not*.. it will
only be called on document.ready...

I was going to use jsbin.com to work up an example for you, but i have
absolutely no idea what the first for loop's purpose is, so
unfortunately i cannot help further



On Jan 2, 5:26 am, direheart <direhe...@hotmail.com> wrote:
> Im unable to store any values from the textarea input. When ever I run the
> for loop to retrieve the values from the array, it is displayed as
> undefined. I not sure how to solve that problem. Any help would be
> appreciated.
>
> --------------------------------------------------------------------------------------------
> $(document).ready(function(){
>    var choices = new Array();
>    var prev = 0;
>    var nex;
>    for(i = 0;i < 10;i++) {
>       $('#textarea1').bind('keypress', function(e) {
>            if(e.keyCode==13){
>                 nex = $('#textarea1').val().length;
>                 choices[i] = $('#textarea1').val().substring(prev,nex);
>                 prev = nex;
>
>            }
>       });
>    }
>
> for(i = 0;i< choices.length;i++){
>       $("#div1").append("<p> " + choices[i] + "</p>");
>    }
>
> });
>
> --------------------------------------------------------------------------------------------
>
> --
> View this message in 
> context:http://old.nabble.com/Help-needed-with-textarea.-tp26991838s27240p269...
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to