This works perfect in jsfiddle but when I place the exact code in my local copy the 'on click' event is not firing. I have jquery, can't figure out why. Any thoughts appreciated.
https://jsfiddle.net/3d867zeu/8/
$( ".dropdown-check-list li input" ).on( "click", function() {
var maxCheckedAllowed = 2;
var n = $( ".dropdown-check-list li input:checked" ).length;
if (n == maxCheckedAllowed) {
$('.dropdown-check-list li input:not(:checked)').prop('disabled', true);
} else {
$('.dropdown-check-list li input:not(:checked)').prop('disabled', false);
}
});
so the DOM has had a chance to load before you start manipulating it? Could be lots of things...
– Andy Sep 04 '17 at 13:36