JQuery .submit() is not working with the form.

  • Profile Image
    Asked on March 21, 2017 at 10:56 PM

    I do wanted to push a datalayer event when my form is been submitted. Using the jquery function .submit form it does not trigger the event. Here is my code.

    $(document).ready(function(){ $("#70542578588369").submit(function(){ dataLayer.push({’event’: ‘order-sim-submit’}); console.log('dataLayer has been push'); });


    Please do help me. I need to track the submission of the form.

  • Profile Image
    Answered on March 22, 2017 at 05:22 AM

    I'm sorry, I'm not sure if I understood your concern correctly, or what you would like to accomplish.

    Do you want to trigger another function once the form is submitted? 

    Note that the form is embedded via script and is using prototype for Javascript, so calling jQuery might conflict with it. 

    Perhaps using the form's full source code and adding the listener there directly would work? You can get the full source code here: https://www.jotform.com/help/104-How-to-get-the-Full-Source-Code-of-your-Form

    If your loading jQuery then I suggest using .noConflict() to avoid conflicting with Jotform's prototype library: https://api.jquery.com/jquery.noconflict/

    I hope that helps. 

  • Profile Image
    Answered on March 22, 2017 at 09:25 PM

    Thanks for the reply,

    Using the full source code instead the embedded source helps me to trigger the function when the form has been submitted.

  • Profile Image
    Answered on March 22, 2017 at 10:52 PM

    I'm glad to hear that. Should you need any assistance again, feel free to open a new thread here in the forum. 

    Thank you.