Created
June 21, 2016 15:55
-
-
Save anonymous/b166987532254bb7557af3a34f34c8aa to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/mubecelelu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-1.9.1.js"></script> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<input type="text" id="growthrate" placeholde="edit growth"> | |
<hr> | |
<table border="1"> | |
<tr> | |
<td data-type="premium" data-year="1">50</td> | |
</tr> | |
<tr> | |
<td data-type="premium" data-year="2">75</td> | |
</tr> | |
<tr> | |
<td data-type="premium" data-year="3">100</td> | |
</tr> | |
</table> | |
<script id="jsbin-javascript"> | |
$(function(){ | |
$("#growthrate").on('keyup', function(e){ | |
var amount = parseInt($(this).val()); | |
var totalAmount = amount; | |
var multiplier = 1.03; | |
$('*[data-type="premium"]').each(function(index) { | |
totalAmount = totalAmount * multiplier; | |
totalAmount = Math.round(totalAmount * 100) / 100; | |
$('*[data-year="' + (index + 1) + '"]').html("$" + totalAmount); | |
}); | |
}); | |
}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">$(function(){ | |
$("#growthrate").on('keyup', function(e){ | |
var amount = parseInt($(this).val()); | |
var totalAmount = amount; | |
var multiplier = 1.03; | |
$('*[data-type="premium"]').each(function(index) { | |
totalAmount = totalAmount * multiplier; | |
totalAmount = Math.round(totalAmount * 100) / 100; | |
$('*[data-year="' + (index + 1) + '"]').html("$" + totalAmount); | |
}); | |
}); | |
});</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$("#growthrate").on('keyup', function(e){ | |
var amount = parseInt($(this).val()); | |
var totalAmount = amount; | |
var multiplier = 1.03; | |
$('*[data-type="premium"]').each(function(index) { | |
totalAmount = totalAmount * multiplier; | |
totalAmount = Math.round(totalAmount * 100) / 100; | |
$('*[data-year="' + (index + 1) + '"]').html("$" + totalAmount); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment