JSFiddle - React, Tailwind, and code Playground
HTML
<input type="number" maxlength='6' name="pincode" id="pincode" size="30" max="999999" >
JavaScript
var pincode = document.getElementById('pincode');
var maxLength = pincode.maxLength;
pincode.onkeypress = function(e){
if( pincode.value.length >= maxLength ){
return false;
}
};