title: How to pass var values to a parameter in javascript?
body: <p>I was trying to use 2 different tables, different input field, and different text in a single script. I use this script below to pass those values on a function parameter to get those values. The problem is I am not getting the <code>input.value</code> but I can get the <code>input1.value</code>. I think the <code>input1</code> is not going inside the <code>filterFunction(input)</code> above</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function filterFunction(table, input, total_amount_id) {
          var filter, tr, td, i, totalViewable = 0;
          console.log(input1.value);
          console.log(input);
          filter = input.value.toUpperCase();
          tr = table.getElementsByTagName("tr");
              for (i = 0; i &lt; tr.length; i++) {
              td = tr[i].getElementsByTagName("td")[1];
              tds = tr[i].getElementsByTagName("td")[0];
              if (td) {
                  if (td.innerHTML.toUpperCase().indexOf(filter) &gt; -1) {
                      tr[i].style.display = "";
                      totalViewable += parseFloat(tds.innerHTML);
                      document.getElementById(total_amount_id).innerHTML = "$" + totalViewable.toFixed(2);
                  } else {
                      tr[i].style.display = "none";
                  }
              }
          }
      }
      var table1 = document.getElementById("dateTable");
      var input1 = document.getElementById("event_date_range");
      var total_amount_id1 = "total_amount_td";
      filterFunction(table1, input1, total_amount_id1);
      var table2 = document.getElementById("dateTable2");
      var input2 = document.getElementById("event_date_range2");
      var total_amount_id2 = "total_amount_td2";
      filterFunction(table2, input2, total_amount_id2);
  &lt;/script&gt;
  </code></pre>