Skip to content

Instantly share code, notes, and snippets.

@HarryStevens HarryStevens/.block

Last active Nov 26, 2019
Embed
What would you like to do?
Indian Number System Converter
license: gpl-3.0

If you get confused converting values between lakhs and crores and lakh crores, this is the tool for you. Enter a number into any of the input boxes, and watch it get converted.

<html>
<head>
<style>
body {
margin: 10 auto;
display: table;
font-family: "Helvetica Neue", sans-serif;
}
input {
width: 100px;
}
div {
margin-bottom: 5px;
}
.indian {
font-weight: bold;
}
</style>
</head>
<body>
<div>
<input type="number" divisor="1"></input>
</div>
<div>
<input type="number" divisor="1e3"></input> thousand (3 zeros)
</div>
<div class="indian">
<input type="number" divisor="1e5"></input> lakhs (5 zeros)
</div>
<div>
<input type="number" divisor="1e6"></input> million (6 zeros)
</div>
<div class="indian">
<input type="number" divisor="1e7"></input> crore (7 zeros)
</div>
<div>
<input type="number" divisor="1e9"></input> billion (9 zeros)
</div>
<div>
<input type="number" divisor="1e12"></input> trillion (12 zeros)
</div>
<div class="indian">
<input type="number" divisor="1e12"></input> lakh crore (12 zeros)
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$("input").keyup(function(){
var val = $(this).val() * $(this).attr("divisor");
$("input").each(function(i, d){
$(d).val(val/$(d).attr("divisor"));
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.