JSFiddle - React, Tailwind, and code Playground

by psharm57

HTML

<!DOCTYPE html>
<html lang="en-US">
<body>
<form action="https://api.iextrading.com/1.0" method="get">
  <div class="form-group">
    <label for="symbol">Symbol</label>
    <input type="name" class="form-control" id="in" placeholder="Enter Symbol">
    </div>
  <input type="submit" value="submit" id="submit" class="btn btn-primary"/>
</form>
<h4>List 1</h4>
<ul id="list1"></ul>
<div id="piechart"></div>

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>



</body>
</html>

JavaScript

google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);

// Draw the chart and set the chart values
function drawChart() {
  var data = google.visualization.arrayToDataTable([
  ['Task', 'Hours per Day'],
  ['Work', 8],
  ['Eat', 2],
  ['TV', 4],
  ['Gym', 2],
  ['Sleep', 8]
]);

  // Optional; add a title and set the width and height of the chart
  var options = {'title':'Stock Prices', '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);
}
function addItem()
{
    $('ul#list1').append("<li>" + $('#in').val() + "</li>");
}

$(function() {
    $('#submit').click(function () {addItem()})
})