title: how to perform maths operation from a string using jquery
body: <p>I am trying to make a calculator by using jQuery. How to perform math operation from a string? I need to display calculator action to the output box.</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-js lang-js prettyprint-override"><code>$(document).ready(function() {
    $("input[type='button']").click(function() {
      var inputtt = $(this).val();
      var displayinput = $("#getinput").val();
      $("#getinput").val(displayinput + inputtt);
    })
    
    $("#submit").click(function() {
      var displayinput = $("#getinput").val();
      var output = parseInt(displayinput);
      $("#output").val(displayinput);
    });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;form id="calcform" method="post" style="background:lightgreen; padding:10px; "&gt;
    &lt;input type="text" id="output" value="" placeholder="OUTPUT" readonly&gt;&lt;br&gt;&lt;br&gt;
    &lt;input type="text" id="getinput" value="" placeholder="INPUT"&gt;&lt;br&gt;&lt;br&gt;
    &lt;input type="button" class="btn" value="-"&gt;
    &lt;input type="button" class="btn" value="+"&gt;
    &lt;input type="button" class="btn" value="*"&gt;
    &lt;input type="button" class="btn" value="/"&gt;
    &lt;input type="button" class="btn" value="c"&gt;&lt;br&gt;&lt;br&gt;
    &lt;input type="button" class="btn" value="0"&gt;
    &lt;input type="button" class="btn" value="1"&gt;
    &lt;input type="button" class="btn" value="2"&gt;
    &lt;input type="button" class="btn" value="3"&gt;
    &lt;input type="button" class="btn" value="4"&gt;&lt;br&gt;&lt;br&gt;
    &lt;input type="button" class="btn" value="5"&gt;
    &lt;input type="button" class="btn" value="6"&gt;
    &lt;input type="button" class="btn" value="7"&gt;
    &lt;input type="button" class="btn" value="8"&gt;
    &lt;input type="button" class="btn" value="9"&gt;&lt;br&gt;&lt;br&gt;
    &lt;button type="button" id="submit"&gt;=&lt;/button&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>