Home  >  Article  >  Web Front-end  >  Enhance user experience friendliness jquery easyui window prompt when the window is closed_jquery

Enhance user experience friendliness jquery easyui window prompt when the window is closed_jquery

WBOY
WBOYOriginal
2016-05-16 17:52:161075browse

My pop-up window is written like this

Copy code The code is as follows:

$('# aa').click(function(){ //Button click event
 $('#w').window({//Window initialization
 title:'Just click',width:400,height: 300,iconCls:'icon_add',
//Important part
onBeforeClose:function(){ //Events triggered before the panel is closed
if (confirm('The window is closing, please confirm your current The action has been saved. Do you want to continue closing the window? ')) {
    $('#w').window('close', true); //The close method is called here, true means that the onBeforeClose callback function is ignored when the panel is closed.
   } else
      return false;
  }
 });
}); When clicking the button of the class, the confirm window will pop up. Click OK to close the window, and click Cancel to keep the window.
If you don’t want the prompt to pop up, just call: $('#w').window('close', true)
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn