title: JS - value of "data-original-title" passing to javascript function
body: <p>I have the following html code, with a function to download content as plain text:</p>
  
  <pre><code>&lt;div class="col-sm-7"&gt;
    &lt;ul class="nav nav-pills nav-justified"&gt;
      &lt;li role="presentation" class="active"&gt;
          &lt;a id="fileNameId" data-toggle="pill" href="#tab" style="font-weight:bold"&gt;Server Name
              &lt;button class="btn glyphicon glyphicon-download-alt text-primary tips pull-right" type="button" onclick="downloadFile('fileNameId', 'contentId')" data-placement="bottom" data-original-title="Download1" style="display:block"&gt; &lt;/button&gt;
          &lt;/a&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  
  &lt;div class="tab-content"&gt;
      &lt;div id="tab" class="tab-pane fade in active"&gt;
          &lt;pre id="contentId"&gt;Some text to download&lt;/pre&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;script&gt;
      function downloadFile(fileNameId, contentId) {
          var element = document.createElement('a');
  
          var content = document.getElementById(contentId).innerText.replace(/\r?\n/g, "\r\n");
          var fileName = document.getElementById(fileNameId).innerText.trim();
  
          console.log(document.getElementById(fileNameId).innerText);
  
          element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(content));
          element.setAttribute('download', fileName+'.txt');
  
          element.style.display = 'none';
          document.body.appendChild(element);
  
          element.click();
          console.log(element);
          document.body.removeChild(element);
      }
  &lt;/script&gt;
  </code></pre>
  
  <blockquote>
    <p>Note: <code>contentId</code> is a <code>pre</code> element whose text I need to download and <code>fileNameId</code>'s innerText changes dynamically, so that the downloaded file name would also change accordingly.</p>
  </blockquote>
  
  <p>Now, the problem is that the <code>fileName</code> variable in JS holds extra text - 'Download1', which happens to be the value of the <code>data-original-title</code> attribute of the button. This can be seen in the o/p of console.log:</p>
  
  <p><code>Server Name
  Download1</code></p>
  
  <p>Because of this, the downloaded file name becomes - <code>Server Name -Download1.txt</code></p>
  
  <p>Is this an expected behavior? How does <code>data-original-title</code>'s value end up being passed from JS when all I do is <code>document.getElementById(fileNameId).innerText</code>?</p>