#357 ✓help_request
ReeRun

Set new element checkbox checked

Reported by ReeRun | September 24th, 2008 @ 09:47 AM

So, what happens... I try to create a new element like so:


var newItem=new Element('input',{type:'checkbox',value:item.id,name:'id'})

Now i want to have it checked when showed. I now do it like this:


newItem.checked=item.checked;

Where item is a JSO created from an AJAX call, which looks like this:


"item":[{"id":114,"name":"Testitem","checked":true}]

Can anyone tell me why this is not working?

Thanks,

Raph

So item.checked in the environment is eval'd as true. Thus far everything is good. But when I try the above to check it by default, nothing happens.

I soon after insert the newly created element in another element:


list.insert(new Element('label').update(newItem).insert(item.name)).insert(new Element('br'));

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket

Pages