2009/3/4 Alex Mcauley <[email protected]>:
>
> Yes walter is correct... As far as i know you cannot insert an element into
> another element if it does not exist in the DOM (as the element is still an
> object that resides in memory at the time) .. though i could be wrong
>
>
>
> ----- Original Message -----
> From: "Walter Lee Davis" <[email protected]>
> To: <[email protected]>
> Sent: Wednesday, March 04, 2009 3:24 AM
> Subject: [Proto-Scripty] Re: Creating Checked Radio buttons, not working in
> IE
>
>
>>
>> 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?
>>
>>
>> >
>>
>
>
> >
>
Even less code...
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',
'checked' : (i = 1) }
);
li.insert(input);
my_list.insert(li);
}
});
--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---