title: how change the font with javascript having the font installed on the local machine?
body: <p>I have a specific font on my local machine. When I create an element and apply inside method <code>textContent</code> the following JavaScript code doesn't change the font family. </p>
  
  <p>custom.js:</p>
  
  <pre><code>// create a element head
  var headElement = document.createElement('style');
  headElement.textContent = "@font-face {\
    font-family: 'Press Start 2P';\
    font-style: normal;\
    font-weight: 400;\
    src: local('Press Start 2P'),\
    url(../fonts/Press_start_2P/PressStart2P-Regular.ttf) format('truetype');\
  }";
  document.head.appendChild( headElement );
  
  // create tag a
  var newElement = document.createElement("a");
  newElement.textContent = "Link 1";
  
  newElement.style.fontFamily = 'Press Start 2P';
  
  var element = document.getElementById("list");
  element.children[0].appendChild(newElement);
  </code></pre>
  
  <p>index.php:</p>
  
  <pre><code>&lt;ul id="list"&gt;
    &lt;li&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I hope that somebody helps me and I apologize for my English. I'm trying write better! </p>