email").attr('checked'); What is the code to set/enable the ch" /> email").attr('checked'); What is the code to set/enable the ch" /> email").attr('checked'); What is the code to set/enable the ch"/>

How to enable a checkbox using AUI script

106 Views Asked by At

This is the code to get the value of a checkbox

         var email = A.one("#<portlet:namespace/>email").attr('checked');

What is the code to set/enable the checkbox with a tick ?

         A.one("#<portlet:namespace/>email").prop('checked', email); //this does not work
         A.one("#<portlet:namespace/>email").set('value', email);//this also does not work

Many thanks

1

There are 1 best solutions below

0
stiemannkj1 On

You can use Node#set:

A.one("#<portlet:namespace/>email").set('checked', true);

Or you can use Node#setAttribute:

A.one("#<portlet:namespace/>email").setAttribute('checked', true);