I've following code snippet at contact form for nickname
field of type single line text. I've wired the onKeyPress at onLoad event of the form and tried to debug but every time it throws exception both at on-prem and online environment.
I would like to seek expert opinionon it.
Code Snippet
function onLoad()
{
Xrm.Page.getControl("nickname").addOnKeyPress(function(){
alert("Hello World");
});
}