title: Manipulating HTML to get data from JSON file and rewrite DOM
body: <p>I have multiple links in my HTML looking like this:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;a class=&quot;wrapper&quot; href=&quot;javascript:FindSKU('12345')&quot; target=&quot;_blank&quot;&gt;TEST&lt;/a&gt;
  </code></pre>
  <p>How do I find the number in a JSON file, return the second value, and then replace everything in the <code>href</code> attribute with this value.</p>
  <p>My JSON File looks like this:</p>
  <pre class="lang-js prettyprint-override"><code>{
      &quot;12345&quot;: &quot;/test1&quot;,
      &quot;1664&quot;: &quot;/test2&quot;,
      &quot;1664T&quot;: &quot;/test3&quot;,
      &quot;1666&quot;: null,
      &quot;1726&quot;: &quot;/test4&quot;,
  }
  </code></pre>
  <p>But I can change it to what ever I need.</p>
  <p>My try so far:</p>
  <pre class="lang-js prettyprint-override"><code>var findATnR = $(&quot;a.wrapper &quot;).a(function('FindSKU') {
      return $(this).attr('href').replace(&quot;javascript:FindSKU('&quot;, '').replace(&quot;');&quot;, '');
  }).get();
  
  var unique = JSON.stringify(findATnR.filter(uniqueArray).sort());
  
  $.get(&quot;Traxxas/traxxas.json&quot;, function(data) {
      $.each(data, function(artNr, sUrl) {
          console.log('art:' + artNr + ', url:' + sUrl);
          if (sUrl === null) {
              $('a.wrapper [href*=&quot;' + &quot;'&quot; + artNr + &quot;'&quot; + '&quot;]')
          } else {
              $('a.wrapper [href*=&quot;' + &quot;'&quot; + artNr + &quot;'&quot; + '&quot;]')
                  .attr('href', sUrl)
                  .attr('target', '_blank');
          }
      });
  });
  </code></pre>
  <p>I get: <code>Uncaught SyntaxError: Unexpected string</code> after first line.</p>