Devang Solanki
Devang Solanki

Reputation: 153

How to get checkbox checked value in AlloyUI?

How to get Liferay AUI taglib checkbox checked value in AlloyUIi ?

<aui:input type="checkbox" ></aui:input>

Upvotes: 3

Views: 9737

Answers (3)

Devang Solanki
Devang Solanki

Reputation: 153

I have developed entire solution for get single checkbox values, It might help to other AUI Script Developer

AUI().ready('aui-node',function(A) {
    A.all(':checkbox').each(function() {
        this.on('click', function(event) {
        var checkBoxStatus = A.all(':checked');
            if(checkBoxStatus.attr('checked') == 'true') {
            // your conditional code
            }
            else { 
            // your conditional code
            }
        });
    });
});

Upvotes: 2

Harsh
Harsh

Reputation: 3009

AUI().ready('aui-base','event','node', function(A){
   if(A.one("#<portlet:namespace />termsAndCondition")){
      A.one('#<portlet:namespace/>termsAndConditionCheckbox').on('click',function(e){ // it  requires Checkbox as prefix in AUI`enter code here`
        if(A.one("#<portlet:namespace/>termsAndConditionCheckbox").attr('checked')){            
            // your code
        }else{              
           // your code
        }
            });
        }
    });

Upvotes: 1

Pankaj Kathiriya
Pankaj Kathiriya

Reputation: 4210

You can get checkbox's checked value by attr method like A.one("#id").attr('checked') where id will be element id of checkbox.

Upvotes: 2

Related Questions