gw-copy-button-for-save-and-continue-link.html

Code

Filename: gw-copy-button-for-save-and-continue-link.html

<!--
 Gravity Wiz // Gravity Forms // Copy Button for Save & Continue Link
 https://gravitywiz.com/
 
 Instruction Video: https://www.loom.com/share/3193ef07ce8e413fbdb2ecc561ce0ae2
 
 Add a button that when click will copy the generated Save and Continue link URL to the user's
 clipboard. 
 
 Note: This will only work for pages served over `https` and will not work in Internet Explorer.
-->

<!-- Add this markup wherever you would like the "Copy" button to appear -->
<button type="button" onclick="gwCopyToClipboard( document.getElementsByClassName( 'resume_form_link' )[0].text )">Copy!</button>

<!--
 Add this script block to the bottom of your "Save and Continue Confirmation" message.
 We recommend disabling auto-formatting for the confirmation as well.
-->
<script>
	const gwCopyToClipboard = async ( text ) => {
		try {
			await navigator.clipboard.writeText( text );
		} catch (err) {
			console.error( 'Failed to copy: ', err );
		}
	}
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.