Search code examples
javascriptjquerylive

jQuery live confirm


I'm having problems with .live() and confirm. It's multiplying the confirm dialogs for every click. I know about .die() but i can't get it to work.

$("button.del").live("click", function(){

        if(!confirm("Are you sure?")) {
            //close
        }

    });

I've tried $("button.del").die("click"); right after the above code, in which case the confim doesn't even fire.


Solution

  • Thank you all for your replies...turn out it was a bug in my code... Sorry...

    I didn't see it... the part of the code with confirm was reloading on every click...hence the multiplying...