JSFiddle - React, Tailwind, and code Playground

by davehol

JavaScript

<script>
(function() {
  document.addEventListener("DOMContentLoaded", function(event) {
    console.log("DOM fully loaded and parsed");
    alert("we're in!");
    var servArray = {
      "future": ["Workforce - Training", "I want to understand what the future looks like for my sector"],
      "commercial": ["Research - Services and Programs", "I'm interested in building a commercial advantage"],
      "skills": ["Workforce - Training", "I'm interested in ways I can develop my team's skills"],
      "connecting": ["Students - Experience", "I'm interested in connecting with RMIT students"],
      "talent": ["Students - Jobs", "I'm looking to hire student talent"],
      "research": ["Research - Capability Deployment", "I'm interested to know how RMIT's research capabilities can help my organisation"]
    };
    var sectorArray = {
      "food": "Agribusiness and food",
      "creative": "Creative industries",
      "edu": "Education and skills",
      "energy required": "Energy, resources and industries",
      "fin": "Financial services",
      "gov": "Government",
      "food": "Life sciences and healthcare",
      "health": "Creative industries",
      "mfg": "Manufacturing",
      "comms": "Media, communications and entertainment",
      "prof": "Professional services",
      "retail": "Retail and consumer",
      "tech": "Technology",
      "def": "Defence",
      "mfg": "Manufacturing",
      "comms": "Media, communications and entertainment",
      "other": "Other"
    };
    var urlParams = new URLSearchParams(window.location.search);
    var serv = urlParams.get('service');
    var sec = urlParams.get('sector');
    //var enq = document.getElementById("tfa_469").value;
    var servVal = "";
    var servTxt = "";
    var secVal = "";
    alert(urlParams.get('service'));
    for (var key in servArray) {
      if (key == serv) {
        servVal = servArray[key][0];
        servTxt = servArray[key][1];
      }
    }
    for (var key in sectorArray) {
     ...