JSFiddle - React, Tailwind, and code Playground

by sjmcpherson

HTML

<div class="someclass">
        <ul>
           <li><a title="someFile" href="somefolder/somefile.pdf">File Name</a>
           <li><a title="someFile2" href="somefolder/somefile2.pdf">File 2</a>
        </ul>
    </div>

JavaScript

var links = document.querySelector('.someclass').getElementsByTagName('a');

Array.prototype.forEach.call(links, function(el) {
    // Do stuff with the element
    console.log(el.tagName);
    el.setAttribute('target','_blank');
});