Hi Paul,

This should do the trick:

$('li').each(function(i){
    array1[ Math.floor( i / 3 ) ] = $(this).html();
});

Cheers,
-Jonathan


On 2/4/08, Paul Jones <[EMAIL PROTECTED]> wrote:
>
>
> I know the following would work if I wanted to copy the values of *each*
> <li>
> to a separate array element.
>
> <html>
> <head>
> <title></title>
>
> <script type = "text/javascript" src="jquery.js"></script>
>
> <script type = "text/javascript">
> var array1 = new Array() ;
> $(document).ready(function()
> {
> $('li').each(function(i) {  array1[i] = this.innerHTML )  })
> })
> </script>
>
> </head>
>
> <body>
>
> <ul>
>    <li>a</li>
>    <li>b</li>
>    <li>c</li>
>
>    <li>d</li>
>    <li>e</li>
>    <li>f</li>
>
>    <li>g</li>
>    <li>h</li>
>    <li>i</li>
> </ul>
>
> </body>
>
> </html>
>
> However, I would like like to copy the *concatenated* values of each group
> of
> 3 <li>'s to 1 array element.
> (eg) the 1st array element would have a value of 'abc', the 2nd array
> element would have a value of 'def', and the 3rd array element would have
> a
> value of 'ghi' etc.
>
> What is the best way to do this?
>
> TIA
>

Reply via email to