jquery on change input checkbox doesn’t work when generated by cf7-data-source

[ad_1]

Hello,

Since I try your plugin, my jquery on change function doesn’t work anymore for input checkbox and I cannot understand why. Event is never catched anymore.

<script>
jQuery(document).ready(function($){

// CALCULE LE TOTAL DES ACTIVITES SELECTIONNEES AU CHANGEMENT DES CHECKBOXES
	$("input[name ^= 'chk_activite_']").on('change', function() {
alert($(this).closest(".wpcf7-checkbox").attr('data-prix'));
                var prix = Number($(this).closest(".wpcf7-checkbox").attr('data-prix'));

		if (this.checked) {
			var total_activite = Number($('#total_activite').val()) + 1;
			var total = Number($('#total').val()) + prix;
		} else {
			var total_activite = Number($('#total_activite').val()) - 1;
			var total = Number($('#total').val()) - prix;
		}

		$('#total_activite').val(total_activite);
		$('#total').val(total);

		if (total_activite < 2) {
			document.getElementById('label_total').innerHTML = total_activite + ' activité sélectionnée pour un montant total de ' + total + ' €';
		} else {
			document.getElementById('label_total').innerHTML = total_activite + ' activités sélectionnées pour un montant total de ' + total + ' €';		
		}
		$('#submit_cb').val('Régler ' + total + ' € en CB sur le site HelloAsso et valider mon inscription');
	});
});
</script>

I don’t very well jquery, input checkbox fileds seems to be genereted the same with and without cf7-data-source plugin…

Thanks in advance for your help 🙂

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer