Easy Tutorial
❮ Home Jeasyui Tree Treegrid2 ❯

jQuery EasyUI Window Plugin - Messager Message Box



Override the default settings via $.messager.defaults.

The message box (messager) provides various styles of message boxes, including alert, confirm, prompt, progress, and more. All message boxes are asynchronous. Users can use callback functions to perform actions after interacting with the message box.

Dependencies

Usage

$.messager.alert('Warning','The warning message');
$.messager.confirm('Confirm','Are you sure you want to delete record?',function(r){
    if (r){
        alert('ok');
    }
});

Properties

Name Type Description Default Value
ok string The text for the OK button. Ok
cancel string The text for the Cancel button. Cancel

Methods

Name Parameters Description
$.messager.show options Displays a message window at the bottom right of the screen. The options parameter is a configuration object: <br>showType: Defines how the message window is shown. Available values are: null, slide, fade, show. Default is slide. <br>showSpeed: Defines the time in milliseconds for the message window to complete showing. Default is 600. <br>width: Defines the width of the message window. Default is 250. <br>height: Defines the height of the message window. Default is 100. <br>title: The title text displayed on the header panel. <br>msg: The message text to be displayed. <br>style: Custom styles for the message window. <br>timeout: If set to 0, the message window will not close unless the user closes it. If set to a non-zero value, the message window will close automatically after the timeout. Default is 4 seconds. <br><br>Example code: $.messager.show({<br> title:'My Title',<br> msg:'Message will be closed after 5 seconds.',<br> timeout:5000,<br> showType:'slide'<br>});<br>// show message window on top center<br>$.messager.show({<br> title:'My Title',<br> msg:'Message will be closed after 4 seconds.',<br> showType:'show',<br> style:{<br> right:'',<br> top:document.body.scrollTop+document.documentElement.scrollTop,<br> bottom:''<br> }<br>});
$.messager.alert title, msg, icon, fn Displays an alert message window. Parameters: <br>title: The title text displayed on the header panel. <br>msg: The message text to be displayed. <br>icon: The icon image to be displayed. Available values are: error, question, info, warning. <br>fn: Callback function triggered when the window closes. <br><br>Example code: $.messager.alert('My Title','Here is a info message!','info');
$.messager.confirm title, msg, fn Displays a confirmation message window with "OK" and "Cancel" buttons. Parameters: <br>title: The title text displayed on the header panel. <br>msg: The message text to be displayed. <br>fn(b): Callback function, which receives a true parameter if the user clicks the OK button, otherwise it receives a false parameter. <br><br>Example code: $.messager.confirm('Confirm', 'Are you sure to exit this system?', function(r){<br> if (r){<br> // exit action;<br> }<br>});
$.messager.prompt title, msg, fn Displays a message window with "OK" and "Cancel" buttons prompting the user to enter some text. Parameters: <br>title: The title text displayed on the header panel. <br>msg: The message text to be displayed. <br>fn(val): Callback function with the user input as the parameter. <br><br>Example code: $.messager.prompt('Prompt', 'Please enter your name:', function(r){<br> if (r){<br> alert('Your name is:' + r);<br> }<br>});
$.messager.progress options or method Displays a progress message window. <br>options are defined as follows: <br>title: The title text displayed on the header panel, default is ''. <br>msg: The main text of the message box, default is ''. <br>text: The text displayed inside the progress bar, default is undefined. <br>interval: The time in milliseconds between each progress update. Default is 300. <br><br>Methods are defined as follows:<br> bar: Gets the progress bar object. <br>close: Closes the progress window. <br><br>Example code: <br>Show progress message window. $.messager.progress(); Now close the message window. $.messager.progress('close');

❮ Home Jeasyui Tree Treegrid2 ❯