Skip to content

Instantly share code, notes, and snippets.

@yohoGDES
Last active January 31, 2020 20:49
Show Gist options
  • Save yohoGDES/a8745e46d54c2af6b082b6e81f97f703 to your computer and use it in GitHub Desktop.
Save yohoGDES/a8745e46d54c2af6b082b6e81f97f703 to your computer and use it in GitHub Desktop.
<style type="text/css">
html .wForm form .wfCurrentPage {
padding-top:20px;
}
</style>
<script type="text/javascript">
setTimeout(function () {
var form = document.querySelector('.wForm');
var formElement = form.querySelector('form');
var totalPages = document.querySelectorAll('.wfPage').length
var lastPage = document.querySelector('.wfCurrentPage').id === 'wfPgIndex-' + totalPages
// Remove top section
formElement.firstElementChild.style.display = 'none';
// Remove bottom links
formElement.lastElementChild.style.display = 'none';
// Add class to stylize and move resume form
formElement.querySelector('.offstate').classList.add('resume-form');
var resumeForm = document.querySelector('.resume-form');
formElement.appendChild(resumeForm);
// Allow form to be saved
document.getElementById('tfa_saveForLater').click()
document.addEventListener('click', function (event) {
// If the clicked element doesn't have the right selector, bail
if (!event.target.matches('.wfPageNextButton')) return;
// If the element ID is the last page, disable the save for later field.
if (event.target.id === 'wfPageNextId' + totalPages) {
// Turn off Save so that Submit can happen
document.getElementById('tfa_saveForLater').click()
}
}, false);
}, 200);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment