title: how to set a data-id in javascript?
body: <p>I want to set <code>data-id</code> after the user put a URL in an input, already tried a lot of samples that I found here and none of these worked...</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>//https://imgur.com/SPrSZV7 im trying with this url
  function getUrl() {
    var txt = document.getElementById('txtURL').value;
    var novaURL = txt.replace('https://imgur.com/', '');
    document.getElementById('resultado').innerHTML = novaURL;
    imagem = document.getElementById('imagem').setAttribute('data-id', novaURL);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script async src="//s.imgur.com/min/embed.js" charset="utf-8"&gt;&lt;/script&gt;
  &lt;!-- ... --&gt;
  &lt;input type="text" id="txtURL"&gt;
  &lt;input onclick="getUrl()" type="submit"&gt;
  &lt;h3 id="resultado"&gt;Resultado:&lt;/h3&gt;
  &lt;blockquote id="imagem" class="imgur-embed-pub" lang="en" data-id=""&gt;
  &lt;/blockquote&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>the <code>data-id</code> should be <code>SPrSZV7</code>, I got in the console the error <code>Cannot read property 'setAttribute' of null</code>, why is this null?</p>