Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
<script src="https://code.jquery.com/jquery-2.2.4.js"></script>
  
</head>
<body>
  <section>
    <label>
      Valor venda:
      <input id="valorVenda"/>
    </label>
    <label>
      Tarifa:
      <input id="tarifa"/>
    </label>
    <label>
      Total:
      <input id="total"/>
    </label>
  </section>
</body>
</html>
 
$(function(){
    $('#valorVenda').on('input', function() {
      calculate();
    });
    $('#tarifa').on('input', function() {
     calculate();
    });
    function calculate(){
        var pPos = parseFloat($('#valorVenda').val()); 
        var tar = parseFloat($('#tarifa').val().replace(",", "."));
        var result = " ";
        if(isNaN(pPos) || isNaN(tar)){
           }else{
           result = ((pPos - ((13.00 * pPos) / 100.00)) - tar).toFixed(2);               
        }
        $('#total').val(result);
        }
});
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers