Avoiding CSS pointer-events ...
First, make sure all the boxes it contains have the class name box (or the like).
Secondly, make the fields inactive with .addClass('inactive') (with the corresponding CSS directives in the stylesheet to keep track of the background color and border). To reactivate the fields, simply .removeClass('inactive') .
Thirdly, delegate the processing of clicks on the boxes into the container as follows:
$('#container').on('click', '.box', function() { //common behaviour (pre) if($(this).hasClass("inactive")) { //inactive box behaviour } else { //active box behaviour } //common behaviour (post) });
source share