Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <label for="totalamt">Amount</label><input id="totalamt" />
  <div style="clear:both;"></div>
  <label for="totalp">Divider</label><input id="totalp" />
  <p>Division of the amount</p>
  <div id="divide" style="border:1px solid black;padding:10px;">
    <input class="amt" / >
  </div>
</body>
</html>
 
$(document).ready(function() {
  var tot = 0;
  var vall = 0;
      var res = 0;
  
  $('#totalp').blur(function() {
    tot = $(this).val();
         var res = (vall / tot);
      $('.amt').val(res);
  });
  
  $('#totalamt').blur(function() {
    vall = $(this).val();
  });
  
});
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers