title: Javascript: How can I get the attribute data of a button's parent ID?
body: <p>As the title says, I'm trying to get the attribute value of a button's containing (parent) element, called `data-id'.</p>
  
  <p>Current code is this:</p>
  
  <pre><code> function onClickGetId(e) {
      //grab data-id number from HTML
      var dataId = document.getElementById("data-id"); &lt;-- returns null right now, need to pull from HTML
      var dataIdFromRow = dataId.getAttribute("data-id");
      var textForVCs = '';
      for (i = 0; i &lt; currentVCData.length; i++) {
          if (currentVCData[i][0] == dataIdFromRow) {
              textForVCs = textForVCs + " " + currentVCData[i][1];
  
              }
      }
      return textForVCs;
      }
  </code></pre>
  
  <p>What should I add in order to make it grab the attribute from the parent ID?</p>