Prevent Dynamic Checking of any disabled checkbox.

Read the Walkthrough

Code

Filename: gppa-gplc-prevent-gplc-disabled-checkboxes-from-getting-dynamically-checked.js

/**
 * Gravity Perks // Populate Anything // Prevent Dynamic Checking of any disabled checkbox.
 * https://gravitywiz.comhttps://gravitywiz.com/documentation/gravity-forms-populate-anything/
 */
$(document).ready(function() {

	function uncheckDisabledCheckboxes() {
		$('.gplc-pre-disabled:checkbox:disabled').prop('checked', false);
	}

	var observer = new MutationObserver(function(mutationsList) {
		for (var mutation of mutationsList) {
			if (mutation.type === 'childList' && mutation.addedNodes.length) {
				$(mutation.addedNodes).find('.gplc-pre-disabled:checkbox:disabled').prop('checked', false);
			}
		}
	});

	observer.observe(document, { childList: true, subtree: true });
});

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.