I have the below function that runs when the page loads, but doesn't run when a checkbox is selected. Can anyone tell why?
My JS
function filterFilesList() {
alert('filter');
}
$("#filterControls :checkbox").click(filterFilesList);
filterFilesList();
HTML
<div id="filterControls"><ul><h4>Business Divisions</h4><li><label><input type="checkbox" value="SMB"><span></span>SMB</label></li><li><label><input type="checkbox" value="DCS"><span></span>DCS</label></li><li><label><input type="checkbox" value="DPS"><span></span>DPS</label></li>
</ul>
</div>
I have tried $("#filterControls ul li :checkbox")
also but that doesn't work
******************EDIT*****************
Turns out this code works fine alone but there is something else in my code stopping it from working properly. I'm assuming the fact that the checkboxes are added dynamically could be causing the problem but thats another issue I suppose. Thanks for you help anyway.