i'm trying to develop a webpart under sharepoint that filters divs, here's what i did
function FilterDivs() {
$('div.filters').find('input:checkbox').click(function () {
$('.items> div').hide();
$('div.filters').find('input:checked').each(function () {
$('.items> div.' + $(this).attr('rel')).show();
});
});
}
this function is working fine with static data i.e with defined filters (checkboxs) and defined items : Example :
<div id="vcf-theme" class="Filters">
<div class="title">Mathematics</div>
<div class="vcf-allInput">
<p class="vcfcb-theme">
<input id="test3" rel="Newcontracts" type="checkbox">
<label for="test3">New contracts</label>
</p>
</div>
</div>
<div id="container" class="items">
<div class="Newcontracts vcf-actus item">
<a href="javascript:void(0);">
<div class="vcf-img">
<span>background</span>
<img src="" alt="Image">
</div>
<div class="vcf-text">
<span>Mathematics</span>
<h4></h4>
<span class="vcf-date"></span>
<p>Curabitur volutpat laoreet sapien eu mattis. Vestibulum volutpat erat vel vestibulum mollis. ...</p>
</div>
</a>
</div>
</div>
this works fine, but what i want is to load dynamicaly the content of div filters and div items too then build checkboxs and items to filter from a SharePoint list by REST calls.
i did all of that and it works fine but now the little filtering function is not working any more since the filtering checkboxs are loaded after it despite i added the magic function ExecuteOrDelayUntilScriptLoaded but the browser is still loading the filtering function before the total loading of checkboxs.
can you help me with this one please, thank you