Skip to content

Instantly share code, notes, and snippets.

@sahanh
Last active February 23, 2018 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sahanh/97bbdb10cda92bfab53fd506ce4669d6 to your computer and use it in GitHub Desktop.
Save sahanh/97bbdb10cda92bfab53fd506ce4669d6 to your computer and use it in GitHub Desktop.
ClickFunnels Field Merge
<script> (function($) { $.QueryString = (function(paramsArray) { let params = {}; for (let i = 0; i < paramsArray.length; ++i) { let param = paramsArray[i] .split('=', 2); if (param.length !== 2) continue; params[param[0]] = decodeURIComponent(param[1].replace(/\+/g, " ")); } return params; })(window.location.search.substr(1).split('&')) })(jQuery); (function(){ function htmlEntities(str) { return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;'); } jQuery(document).ready(function($){ $.each($.QueryString, function(key, value) { var html = $('#'+key).html(); $('#'+key).html(html.replace('#??', htmlEntities(value))); }); }); })(); </script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment