Tamil Codes
Delete confirmation using javascript
By TamilCodes
Added on September 10, 2009
Viewed 967 Times

 When you try to delete a record, set of records you may want to confirm again to delete. If you delete a bunch of records accidentally by clicking a button all the data will be lost. You can add a javascript confirm box to any of the button's onclick event or link's onclick event to popup to confirm when you want to delete data.

For this example I have just added the onclick event to an anchor tag. The javascript in the event will return true if you click OK in the confirm box or return false if you click cancel. If the return value is true the page will redirected to the delete page. If the return value is false the page will not redirect. It is just a lind of code.

<a href="delete.aspx?id=1" onclick="return confirm('Are you sure you want to delete?')">Delete</a>  
 


Click here for Demo

 

 


Comments
No Comments. Be the first to post comments
   
Name:
Comments:
     
   

© 2008 - 2010. Tamilcodes.com. All rights reserved.
Valid XHTML 1.0 Transitional Valid CSS!