$(function() { $(document).on('click',"*[data-toggle=buttons-checkbox] input",function(){ var d = $(this).parent().find("input[type=hidden]"); if($(this).is(":checked")){ d.val("1"); }else{ d.val("0"); } }) });