Click here to Skip to main content
15,893,190 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created a modal div with title bar, custom icons and z-index by using javascript. I am not using jquery ui modal.
I can display the modal div by calling a function
JavaScript
$(document).ready(function (){
   notify = function notify(mode, title, message, type) {
     createDialog(mode, title, message, type);
   }

   function createDialog(mode, title, message, type) {
      //code to create custom content
      appendDialog(customHtmlContent);
   }

    function appendDialog(content) {
        var body = $(document).find('body');
        $(body).append(content);
    }

   $(document).on('click','span#closeNotification',function(){
     //code to remove modal dialog
   });

   $(document).on('click','span#showNotification',function(){
     notify('mode','title','message','info');
     otherFunction();
   });
});

But the problem is that after showing the modal dialog i want to halt the javascript code execution. After the dialog is closed by the user continue and execute the further javascript code.

What I have tried:

I have not tried anything as yet to add this functionality
Posted
Updated 27-Feb-17 15:34pm
Comments
ZurdoDev 27-Feb-17 11:59am    
chrome does not support what you want, and FireFox will not either soon (or maybe already). What you need to do is call a function when the modal is closed.
Christopher Fernandes 27-Feb-17 12:21pm    
No! what i want is until the dialog is not closed the next line of javascript code in the same code block should not execute.
Richard Deeming 27-Feb-17 14:56pm    
That is not supported.

showModalDialog | MDN[^]
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The feature was removed in Chrome 43 and Firefox 46.
Karthik_Mahalingam 27-Feb-17 21:31pm    
Always use  Reply  button, to post Comments/query to the user, so that the user gets notified and responds to your text.
Bryian Tan 28-Feb-17 0:20am    
Why not just place otherFunction(); inside $(document).on('click','span#closeNotification',function(){ ? I'm assuming that the function that close the dialog.

1 solution

check this thread, you wil find lot of answer for this question
javascript - Stop page execution like the alert() function[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900