i have an asp.net button in my page. i would like to set and retrieve the OnClientClick property of the button using JavaScript, but get undefined when i display the property’s value using
alert(printButton.OnClientClick)
i set the printButton object with this code:
var printButton = args.get_item().get_cell("TemplateColumnView").getElementsByTagName('input')[0]
i know that is code works because i am able to retrieve the id, src etc. properties of printButton but cannot get OnClientClick.
OnClientClickis ASP.NET. The client click event in ASP.NET is the same as the click event in JavaScript.Using your
printButtonvariable, in Firefox, Chrome, and Safari, it would look something like this:In IE:
Or with the jQuery framework: