Hey Patrick
The code is working just like magic. Thank you so much. However, I have shorten the code to fit it exactly what I need. I am sharing the code if anyone wants the same.
Thanks a lot again. You deserve 5*
add_action(
'wp_footer',
function() {
if ( ! wp_script_is( 'forminator-front-scripts' ) ) {
return;
}
?>
<script type="text/javascript">
jQuery(document).ready(function ($) {
$(document).on('after.load.forminator', function (e, form_id) {
var next_button = document.querySelector('.forminator-button-next'),
click_event = new CustomEvent('change_evt'),
clickable_elements = document.querySelectorAll(
'.next-on-click .forminator-radio',
),
radios = document.querySelectorAll('.next-on-click input[type="radio"]');
clickable_elements.forEach((clickable_element) => {
clickable_element.addEventListener(
'click',
wpmudev_clickables_event_callback,
);
clickable_element.addEventListener(
'touchstart',
wpmudev_clickables_event_callback,
);
});
function wpmudev_clickables_event_callback() {
radios.forEach((radio) => {
radio.addEventListener('change', wpmudev_change_evt_callback);
});
}
function wpmudev_change_evt_callback(e) {
if (e.currentTarget.checked) {
$('.forminator-button-next').trigger('click');
}
}
});
setTimeout(function () {
$('.forminator-custom-form').trigger('after.load.forminator');
}, 100);
});
</script>
<?php
},
999
);