How to Function create Delegate

Steps create client delegate:

  1. Create client delegate by using Function.createDelegate(this, functionName)
  2. Add the new delegate into $addHandler(this, newDelegate)

Example:

function pageLoad() {
var clickDelegate = Function.createDelegate(this,onButtonClick);
$addHandler($get('btnTest'),'click',clickDelegate);
}
function onButtonClick()
{
alert(“inside button click”);
}