ux dialog

Description

A modal dialog box

Parameters

string

The title

string

The HTML content

object

json object with all options to render the control:

icon

An icon to show in the message

buttons

Array of objects with the definitons of the buttons

( id, title, type [is-success/is-info/is-warning/is-danger]] )

function

Function to call when the dialog is closed or a button is pressed

The pressed button id is sent as parameter (or null if closed without press any button)

Return


No return value

Example


<a href="#" onclick="dialog_example()">Click here</a> to display a modal dialog
 <script>
    function dialog_example() {
      ux.dialog("UX Tutorial","This is a dialog.<br> Do you like it?", {buttons:[ {id:'Y', title:'Yes'},{id:'SY',title:'SUper Yes'}]}, function(b) { alert('You pressed the button with id: '+b); } );
    }
</script>

 

Preview:

In the preview of the example you can see the result of the string:

"Click here to display a modal dialog box."

- by clicking the link in the preview, a dialog box to opens for testing:

UX_Tutorial_dialogbox