hi there

Thanks Walter, your advise helped, here just the javascript that ended
up working. (How about that the codes is even a bit tighter.)

 -jachin

document.observe("dom:loaded", function() {

        var my_list = $('my_list');

        for( i = 0; i < 3; i++ ) {

                var li = new Element( 'li' );

                var input = new Element(
                        'input',
                        { 'type': 'radio',
                          'value': i,
                          'name': 'test' }
                );

                li.insert(input);

                my_list.insert(li);

                if ( i == 1 ) {
                        input.checked = true;
                }
        }
});

On Mar 3, 9:24 pm, Walter Lee Davis <[email protected]> wrote:
> Try inserting it, then checking it after it's in the DOM. Also, try  
> setting input.checked = true rather than adding that as a part of the  
> initial new Element deal.
>
> if ( i == 1 ) {
>         var input = new Element(
>                 'input',{
>                   'type': 'radio',
>                   'value': i,
>                   'name': 'test'
>                 }
>         );
>         li.insert(input);
>         input.checked = true;}else{
>
>         var input = new Element(
>                 'input',{
>                   'type': 'radio',
>                   'value': i,
>                   'name': 'test'
>                 }
>         );
>         li.insert(input);
>
> }
>
> See if that helps.
>
> Walter
>
> On Mar 3, 2009, at 6:49 PM, jachin wrote:
>
>
>
> > Does anyone know of a work around to this problem? A way to get a
> > dynamically generated radio button selected?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to