How do I pass a variable value which was collected from user input from one function to another (javascript)

I am trying to create a page on html that automatically creates a pie chart with data provided from the user input form. I am trying to pass the values tax, mort,f,transport,and saving from collect() to drawChart() so that it could use those values to create the pie chart, but it doesn’t seem to work. Does anyone know why?

function collect() {
    var tax = +document.getElementById("taxes").value;
    document.getElementById('tax').innerHTML = tax;

    var mort = +document.getElementById("mortage").value;
    document.getElementById('mort').innerHTML = mort;

    var f = +document.getElementById("food").value;
    document.getElementById('f').innerHTML = f;

    var transport = +document.getElementById("transportation").value;
    document.getElementById('transport').innerHTML = transport;

    var saving = +document.getElementById("savings").value;
    document.getElementById('saving').innerHTML = saving;

    drawChart(tax,mort,f,transport,saving);
}


    function drawChart(val1,val2,val3,val4,val5) {
  
    var data = google.visualization.arrayToDataTable([
    ['Expense/Income', '$ per Month'],
    ['Taxes',val1],
    ['Mortage', val2],
    ['Food', val3],
    ['Transportation', val4],
    ['Savings',val5]
    ]);
var options = {'title':'Monthly Budget', 'width':550, 'height':400};

    // Display the chart inside the <div> element with id="piechart"
    var chart = new google.visualization.PieChart(document.getElementById('piechart'));
    chart.draw(data, options);
    }
<div class="editTable">
  <div class="left">Taxes: </div><div class="right"><input type="number" name="taxes" id="taxes"></div><br><br>
  <div class="left">Mortages: </div><div class="right"><input type="number" name="mortage" id="mortage"></div><br><br>
  <div class="left">Food: </div><div class="right"><input type="number" name="food" id="food"></div><br><br>
  <div class="left">Transportation: </div><div class="right"><input type="number" name="transportation" id="transportation"></div><br><br>
  <button onclick="collect();" class="editRowBtn">Update</button><br><br>
</div>