I’m trying to fix not working download link, which have to also trigger Gravity Form submit.
Works only $("a")[0].click(); I added it to test overall code.
There are no errors in the console. Any ideas? Thanks!
$('.download-pdf-link').click(function() {
// $('#gform_submit_button_3').trigger('click');
$('#gform_submit_button_3').click();
//$("a")[0].click();
});
<div class='gform_footer top_label'> <input type='submit' id='gform_submit_button_3' class='gform_button button' value='Submit' tabindex='52' onclick='if(window["gf_submitting_3"]){return false;} window["gf_submitting_3"]=true; ' onkeypress='if( event.keyCode == 13 ){ if(window["gf_submitting_3"]){return false;} window["gf_submitting_3"]=true; jQuery("#gform_3").trigger("submit",[true]); }' />
<a class="btn download-pdf-link" download>Submit and Download</a>
p.s. Tested and not working:
1. var $form = $(this).closest('form');
$form.find('input[type=submit]').click();
2. $(this).closest("form").submit();
2
Answers
I found the working solution:
Does this work?