Hi ,

I want to confirm a delete function using javascript .. In detail

I want to display a list using php Mysql as follows

No + Name +
----------------------------------
1. + Raj + Delete
2. + Raj2 + Delete
----------------------------------

When user clicks on Delete button that will leads to another php page which contains directions for deleting that entry.

But before that I want to do a confirmation which saying "Are you sure want to delete ? "

When user clicks on OK button that will continue to delete function and otherwise that will cancel..

Please help me how we can do this with Javascript

Thanks in advance
Rajeesh

Put a onClick in the delete button
example

<input type="button" value="Delete" onclick="return confirm('Are you sure you want to delete?');)">

What it will do is ,it will show you confirm,so if you click yes,there confirm returns 'true'. So if true is returned write some php code there,else do some other stuff.

Thanks for the reply ..

Thanks

Put a onClick in the delete button
example

<input type="button" value="Delete" onclick="return confirm('Are you sure you want to delete?');)">

What it will do is ,it will show you confirm,so if you click yes,there confirm returns 'true'. So if true is returned write some php code there,else do some other stuff.

my Pleasure,hope it worked :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.