title: How to put an id inside of an alert in javascript
body: <p>I made a code to get user input and add items to a list. Im now trying to add a button that racks the sum of all the numbers in a list and displays it when a button is clicked. Right now the code displays an alert when the button is clicked, but does not display the sum.</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-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
  &lt;head&gt;&lt;/head&gt;
  
  &lt;body&gt;
  
    &lt;input type='text' id='input' /&gt;
    &lt;input type='button' value='add to list' id='add' /&gt;
  
    &lt;ul id='list'&gt;
      &lt;li&gt; &lt;b&gt;Topics&lt;/b&gt;&lt;/li&gt;
    &lt;/ul&gt;
    
    &lt;h3&gt;
      
    &lt;!--- &lt;button id="sum"&gt;0 &lt;/button&gt; ---&gt;
      
     &lt;button onclick="reply_click(this.id)"&gt;Click Here To See The Sum&lt;/button&gt;
  
  &lt;script type="text/javascript"&gt;
  function reply_click(clicked_id)
  {
      alert(clicked_id);
  }
  &lt;/script&gt; 
      
    &lt;/h3&gt;
  
  &lt;/body&gt;
    
  &lt;script&gt;
    var sum = 0;
  
  document.getElementById("add").onclick = function() {
    var text = document.getElementById("input").value;
    var li = document.createElement("li");
    li.innerText = text;
    sum += parseInt(text);
    
    document.getElementById("list").appendChild(li);
    document.getElementById("sum").innerHTML = sum;
  }
    
    function sumvar() {
      alert("The sum of your numbers are ");
    }
    &lt;/script&gt;
    
    
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>