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 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();
CodePudding user response:
Does this work?
jQuery(document).ready(function($) {
$('.download-pdf-link').click(function() {
$(this).closest("form").submit();
});
});
CodePudding user response:
I found the working solution:
$('.download-pdf-link').click(function() {
$("#gform_3").trigger("submit",[true]);
});