这是获取复选框值的代码
var email = A.one("#<portlet:namespace/>email").attr('checked');
用勾号设置/启用复选框的代码是什么?
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
非常感谢
您可以使用Node#set
:
A.one("#<portlet:namespace/>email").set('checked', true);
或者您可以使用Node#setAttribute
:
A.one("#<portlet:namespace/>email").setAttribute('checked', true);