JavaScript: Confirm User Action Script


<script language="javascript" type="text/javascript">
    function ConfirmDeleteSomething() {
        return confirm("Warning: This Something will be permanently deleted. Would you still like to continue? ");

<asp:LinkButton ID="lbtnDelete" runat="server" 
    OnClientClick="return ConfirmDeleteSomething()">Delete Something


To make sure that a user is actually sure they want to perform an unrecoverable action, such as deleting something, you may want to add a confirmation dialog warning the user of what their potential actions may do.

To do this using JavaScript simply add a function which calls the ‘confirm’ command and call that function through the ‘OnClientClick’ event of your button control in

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s