javascript - return true for click event and continue -


hi have popup window control i'm trying todo continue click event if user chooses yes button. how continue click event 'yes' button, i'm trying make return true doesn't continue click return false.

<script type="text/javascript">      $(document).ready(function() {          $('.delete-question').click(function(e) {                                ret = false;                 _this = this;              $('#pop-up-1').popupwindow({                 modal: true,                 blurclass: '.main-container',                 action: "open",                 buttons: [{                     text: "yes",                     click: function () {                          this.close();                         ret = true;                     }                 }, {                     text: "no",                     click: function () {                         this.close();                                                        }                 }]             });               return ret;         })       }); </script> 

you can't directly, can emit click event once needed, e.g. (not tested):

<script type="text/javascript">      // global flag track popup state     var popupreturn = false;      $(document).ready(function() {          $('.delete-question').click(function(e) {             // when true (after yes click only) go on returning true             if (popupreturn) {                 popupreturn = false;                 return true;             }             else {               _this = this;                $('#pop-up-1').popupwindow({                   modal: true,                   blurclass: '.main-container',                   action: "open",                   buttons: [{                       text: "yes",                       click: function () {                           // set global flag true                           popupreturn = true;                           // emit click event knows popupreturn true                           $(_this).click();                           this.close();                       }                   }, {                       text: "no",                       click: function () {                           this.close();                                                          }                   }]                 });                 return false;             }         })       }); </script> 

Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -