Insert this custom code dynamically?

I’d like to drop this signup button dynamically onto a webinar signup page (it’s a template page for a CMS collection).

`<link href="//app.webinarjam.net/assets/css/register_button.css" rel="stylesheet">
 <div style="margin:auto;width:300px;">
    <div class="embedded-joinwebinar-button">
     <button type="button" class="btn btn-default css3button" title="regpopbox_19538_4a82a5d2a5">
      <span>Register now</span>
    </button>
   </div>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js" language="javascript" type="text/javascript"></script>
<script src="//app.webinarjam.net/assets/js/porthole.min.js" language="javascript" type="text/javascript"></script>
<script src="//app.webinarjam.net/register.box.js" language="javascript" type="text/javascript"></script>
<div id="frameContent" style="-webkit-overflow-scrolling: touch !important; overflow: auto;top: 0; left: 0; background:#fff;position: fixed; width: 100%; height: 100%; display:none; z-index:2147483647;"></div>
<img src="//app.webinarjam.net/tracker?action=registration&webicode=4a82a5d2a5&memberid=19538" style="visibility:hidden; height:0px; width:0px; border:none;">`

I’m using this bit of code to drop some stuff into a source field in a form, elsewhere on the page. Could I use the same logic to drop this code in where it’s needed and get around the issue of not being able to use custom code elements on a dynamic page?

<script>
      $(document).ready(function() {
        $("#source").val("{{source-tag}}");  	
    }
    );
</script>

As far as I can tell, the webicode is the only thing that will be unique for each button. Could I put this code into a custom code element, then just dynamically drop that webicode id into the element via the CMS?

Hello, @Chris_Scott

Yes, your guess is right. Just add one more text field in the dynamic item structure and then inside the code snippet just change the webicode itself on that field.

2 Likes