Last active
November 27, 2019 05:57
-
-
Save IronGhost63/b622bbec9a706f718a7e76167b312781 to your computer and use it in GitHub Desktop.
Reinit gravity form after submission
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import '@nobleclem/jquery-multiselect'; | |
export default () => { | |
let FormElement = $('.content-form__form-wrapper'); | |
if ( FormElement.length ) { | |
let FormId = FormElement.attr('data-form-id'), | |
FormHtml = $('<div />').append(FormElement.clone()).html(); | |
$(document).on('gform_confirmation_loaded', function() { | |
FormElement.find(`.gform_confirmation_message_${FormId}`).wrap('<div />').parent().html(FormHtml); | |
FormElement.find(`#gform_wrapper_${FormId}`).unwrap(); | |
$(document).trigger('gform_post_render', [FormId, 0]); | |
$('#submission').modal(); | |
}); | |
$(document).on('gform_post_render', function(){ | |
$('.gfield_select[multiple]').multiselect(); | |
}); | |
jQuery('.gfield_select[multiple]').multiselect(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment