Hi,
It was little bit difficult to get your problem initially but after a while what I understood is you have json data and from that you will separate true & false values And append the same to specific positions inside the div element.
As,I am not clear with your requirement, the following solution came to mind. Hope, a better code will be achieved when requirement will be more clear.
Try the code below & reply with your questions...
function binditem(jsondata) {
var arrFalse = [];
var arrTrue = [];
for (var i = 0; i < jsondata.length; i++) {
var item = jsondata[i];
if (item.chkval == false) {
arrFalse.push(item);
}
if (item.chkval == true) {
arrTrue.push(item);
}
}
for (var i = 1; i <= arrFalse.length + arrTrue.length; i++) {
var countTrue = 0;
var countFalse = 0;
if (i == 1 || i == 9 || i == 17)
{
$('<div />', {
"id": 'yourIdFalse',
"class": 'col-xs-12 col-md-6',
html: arrFalse[countFalse]
}).appendTo(parentId);
countFalse++;
}
else
{
$('<div />', {
"id": 'yourIdTrue',
"class": 'col-xs-12 col-sm-6 col-md-3',
html: arrTrue[countTrue]
}).appendTo(parentId);
countTrue++;
}
}
}
Thanks,
Prateek