Can we have onkeypress trigger of doctype field

Example of old used code:
address_input = $(this.frm.parent)[0].childNodes[0].childNodes[3].childNodes[1].childNodes[1].childNodes[0].childNodes[6].childNodes[2].childNodes[0].childNodes[1][0].childNodes[4].childNodes[3]
address_input.onkeypress=function(e){
d = e.which
cur_frm.cscript.map(e);
};

cur_frm.get_field("address").$input.on("keypress", function() { ... });

No comments on your code.