[wd_asp elements=’search’ ratio=’100%’ id=1]

Jquery confirm() Popup – Yes – no Box – Cancel

12th June 2014

Jquery - Validation

jquery icon

$('#contentLeft li').click(function(){

var txt;
var r = confirm("Press a button!");
if (r == true) {
txt = "You pressed OK!";
$(this).remove(); //deletes element from dom

} else {
txt = "You pressed Cancel!";
}

another version

$('#contentLeft li').click(function(){
var thetext = $(this).html();
var txt;
var r = confirm("Do you want to delete \n" + thetext + " ?");
if (r == true) {
txt = "You pressed OK!";
$(this).remove();

} else {
txt = "You pressed Cancel!";
}