Search code examples
asp.netjavascriptobject-expected

Adding Javascript Confirm Dialog to LinkButton/Form generates Object Expected error


I am attempting to add a javascript confirm dialog to either my linkbutton onclick event or my form onsubmit event.

Neither of them work as I receive an 'object expected' error from the browser.


frm.Attributes.Add("onsubmit", "return Confirm('Really do this?')")

How do I add a confirm dialog to the 'onsubmit' or 'onclick' events without generating an 'object expected' error?


Solution

  • confirm method should be all lowercase letters

    Ex

    confirm('Really do this?')