Skip to content Skip to sidebar Skip to footer

Javascript Confirmation Popup

I am new to javascript and web development, now I am experimenting in codeigniter and I want to setup a javascript confirmation box on a delete link. Now I got it to work reasonabl

Solution 1:

Try this...

HTML:

<a href="#"id="btn-delete">Delete</a>

JS:

//window.onload = function() {var btnDelete = document.getElementById('btn-delete');
    btnDelete.onclick = function() {
        var message = 'Are you sure you want to delete the group?';
        if (confirm(message)) {
            // delete something...
        }
    }
//};

http://jsfiddle.net/PEHx9/

Post a Comment for "Javascript Confirmation Popup"