Skip to content Skip to sidebar Skip to footer

Trigger Change Event Of A Checkbox

I've 7 checkboxes (A,B,C,D,E,F,G) and when I click one of them, the value is appended to a textarea. If I uncheck one, the value is removed from the textarea. The jquery code is as

Solution 1:

This seems to work for me:

$(".firm[value='C']").change(function(){
        $(".firm[value='D'], .firm[value='E'], .firm[value='F'], .firm[value='G']").prop('checked', false).trigger("change");
        $(".firm[value='D'], .firm[value='E'], .firm[value='F'], .firm[value='G']").attr("disabled", $(this).is(":checked"));  
    });

You can see it in action here: https://jsfiddle.net/aaronfranco/cvhphzgq/2/


Post a Comment for "Trigger Change Event Of A Checkbox"