I am adding a click event for a flag that will show / hide additional fields depending on its checked state. I want the handler to start loading in order to customize the initial page structure. For some reason, triggerHandler does not work on the field. If I change it to a βtriggerβ, the handler will start firing, but the status of the flag will also change. You see what I did wrong / why triggerHandler does not work?
$('body').on("click", "#hdimage", function(){ console.log('hd'); if(!$('#hdimage').is(':checked')){ $('.sd-dim').hide(); } else { $('.sd-dim').show(); } }); $('#hdimage').triggerHandler('click');
Rumpleteaser
source share