javascript - How do you stop and then start / trigger an event with JQuery? -


I'm trying to stop the default action when a link is clicked. Then I ask for confirmation and if I want to continue this incident then it has been confirmed. How do I do this? I can stop the incident but it can not start here that I have done so far:

  $ (document) .ready (function () {$ (".le") Click (function) {event.preventDefault (); if (Confirm ('do you want to delete it?') {If (event.isDefaultPrevented ()) {//}}}}}} );}); There is no need to stop the default to start  

. Just do this:

  $ (function () {$ (". Del"). Click (function (evt) {if (! Confirmation ("Are you sure you want to delete it? ")) {Evt.preventDefault ();}}}}});  

Rather than preventing the event, it is easier and more logical to stop it and then to stop it (even if it is possible).

Remember that when the user chooses to correct or cancel, the code will stop running when the user submits the confirmation box.

By the way, take a look. If you want to stop the promotion of the event or not, you can either call stopPropagation () or return :

  $ (Function () {$ (". Del"). (Function (evt) {If (Confirm ("Are you sure you want to delete it?")) {Return false;}})}} ;  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -