Archived topic
Adding a Hook with jQuery
5 replies · Started by ch1800 on October 29, 2020
Hello,
I need to add the following code for a date calculation with the form builder:
jQuery(document).on( 'after.load.forminator', function( form_id ){
// Get today date
var d = new Date();
var year = d.getFullYear();
var month = d.getMonth();
var day = d.getDate();
// Today + 1 year
var c = new Date(year + 1, month, day);
document.querySelector('#forminator-module-1888 #hidden-2').value = c;
} );
});
I understand I need to use a Hook for that but don't know which type of hook is best suited here.
Thanks!
Hi,
Usually, we add these kinds of things on wp_head.
If it returns an error, try wp_footer.
Thanks Elvin,
I also need to add those open/closing tags, right?
<script>
</script>
Thanks Elvin,
I also need to add those open/closing tags, right?
Yeah that's right. :)
Great, many thanks!
No problem. :)