title: Using Javascript to create a wildcard link
body: <p>Struggling with making a wildcard link with JavaScript and in general using JavaScript to create links. Would love to store my html links in JavaScript and push them into the html while being able to make them dynamic links.</p>
  
  <p>Basically I have a lot of documents I'm linking from SharePoint for easier access to my team at work. My boss want's them to be wildcard links, dynamic as opposed to static, and I'm really struggling as being a relative noob at JavaScript.</p>
  
  <p>This is an example of the HTML I'm working on.   </p>
  
  <pre><code>&lt;h2&gt;Quality Management Key Documents&lt;/h2&gt;
  &lt;div class="dropdown"&gt;
       &lt;button onclick="myFunction1()" class="dropbtn"&gt;Corporate Manual Policies and User Manual&lt;/button&gt;
        &lt;div id="Corporate Manual Policies" class="dropdown-content"&gt;
  **&lt;!--This is the example/practice version--&gt;**   &lt;button onclick =  "link()" class="page-header"&gt;Works?&lt;/button&gt;
            &lt;a href="javascript:getURL()"&gt;Derpalot&lt;/a&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>And this is the JavaScript Code I'm trying to work with.</p>
  
  <pre><code>var links = [];
  links[0] = "link",
  "Corporate Quality Manual"; //etc in terms of links
  
  var link = document.createElement('link');
  link.setAttribute(link);
  link.innerHTML = desiredText;
  
  function linkA() {
  document.getElementsByTagName('link')[0].innerHTML += '&lt;a href="'links[0]'"&gt;' + links[0] + '&lt;/a&gt;';
  };
  </code></pre>