Batasi input HTML ke dua tempat desimal

//Force User Input to Two Decimal Places
//From https://stackoverflow.com/questions/46321683/javascript-restrict-input-once-2-decimal-places-have-been-reached

//HTML Code
<input type="text" oninput="validate(this)" />
  
//JavaScript Code
<script type="text/javascript">
var validate = function(e) {
  var t = e.value;
  e.value = (t.indexOf(".") >= 0) ? (t.substr(0, t.indexOf(".")) + t.substr(t.indexOf("."), 3)) : t;
}
</script>
DevShot