title: how to add javascript to a web form in Microsoft Dynamics 365
body: <p>I am making a web form in Dynamics 365 and am currently trying to figure out, how to add a javascript code to it. Web form is working and is displayed correctly (submit also works), but the problem is in the way javascript code has to be added. I tried following this guide: <a href="https://docs.microsoft.com/en-us/dynamics365/marketing/developer/marketing-form-client-side-extensibility" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dynamics365/marketing/developer/marketing-form-client-side-extensibility</a></p>
  
  <p>The problem is that I can't get even the basic console.log() to run. I added the code to the form in a script tag in the &lt; head>, like this, but the code gets removed when i inspect the webpage upon load. loader.js, which is needed, loads. Here is the sample code, that I added.</p>
  
  <pre><code>&lt;pre&gt;
  &lt;script type="text/javascript"&gt;
  console.log("SHOW ME");
  MsCrmMkt.MsCrmFormLoader.on("formLoad", function(event) {
      console.log("formLoad");
  })
  MsCrmMkt.MsCrmFormLoader.on("formRender", function(event) {
      console.log("formRender");
  })
  &lt;/script&gt;
  &lt;/pre&gt;
  </code></pre>
  
  <p>Can somebody help me and show me what is the correct way to add JS code to the page?</p>
  
  <p>Thank you</p>