[Resolved] Adding a Hook with jQuery

Home Forums Support Adding a Hook with jQuery

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1510366
    ch1800

    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!

    #1510387
    Elvin
    Staff
    Customer Support

    Hi,

    Usually, we add these kinds of things on wp_head.

    If it returns an error, try wp_footer.

    A wise man once said:
    "Have you cleared your cache?"

    #1510393
    ch1800

    Thanks Elvin,

    I also need to add those open/closing tags, right?

    <script>
    </script>
    #1510439
    Elvin
    Staff
    Customer Support

    Thanks Elvin,

    I also need to add those open/closing tags, right?

    Yeah that’s right. πŸ™‚

    A wise man once said:
    "Have you cleared your cache?"

    #1510442
    ch1800

    Great, many thanks!

    #1510443
    Elvin
    Staff
    Customer Support

    No problem. πŸ™‚

    A wise man once said:
    "Have you cleared your cache?"

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.