Label needs for attribute for buttonset to work and also labels and checkboxes should not be nested.
In the demo, I changed the way inputs and labels are rendered as per the documentation here
Documentation says
For the association to work properly, give the input an id attribute, and refer to that in the label's for attribute. Don't nest the input inside the label, as that causes accessibility problems.
$(document).ready(function() {
var N = 30;
for (var i = 1; i <= N; i++) {
var $input = $('<input/>', {
type: "checkbox",
id: "checkbox-" + i
});
var $label = $('<label/>', {
id: "label-" + i,
for: "checkbox-" + i
}).append(i);
$("#showChck").append($input).append($label);
}
$("#showChck").buttonset();
});
$(document).ready(function() {
var N = 30;
for (var i = 1; i <= N; i++) {
var $input = $('<input/>', {
type: "checkbox",
id: "checkbox-" + i
});
var $label = $('<label/>', {
id: "label-" + i,
for: "checkbox-" + i
}).append(i);
$("#showChck").append($input).append($label);
}
$("#showChck").buttonset();
});
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<div data-role="fieldcontain" id="channels" style="display:block;">
<fieldset id="showChck" data-role="controlgroup" data-type="horizontal">
</fieldset>
</div>