How to confirm clicking on a link using jQuery
问题 I have many links in a HTML-table, which delete corresponding row, when clicked (calling a PHP-script via GET parameter). They all have a class delete_row . How could I please display a confirm('Really delete?') dialog using jQuery, when such a link is clicked? And of course prevent following that link when No has been selected in the dialog. 回答1: Try this. $('.delete_row').click(function(){ return confirm("Are you sure you want to delete?"); }) 回答2: Very simple and effective one line