Get Free Trial
API reference
Table of contents

alert

alert(alertConfigs: Object)

[starting from version: 2.6.5]

This API call shows an alert pop-up window with a custom message.

Parameters

alertConfigs – the object that describes the alert pop-up. This object has the following parameters:

  • title – String. The title of the pop-up. Default value: "".
    Note: either title or message is required to show the alert pop-up.
  • message – String. The message of the pop-up. Default value: "".
    Note: either title or message is required to show the alert pop-up.
  • type optional – String. The type of the pop-up. Available types: "alert""confirmation""error""info". Default type: "alert".
  • buttons optional – Array of objects. By default, theOK button is shown. buttons is used to set custom buttons. Each object in buttons represents one button in the pop-up and has the following properties:
    • label – String. The label of the button.
    • handler – Function. The function that handles clicks on this button.
  • blocking optional – Boolean. Defines whether the pop-up is blocking other actions until its button is clicked. Default value: false.

Example

Show the pop-up:

flexmonster.alert({
	title: "Error Title",
	message: "An error message",
	type: "error",
	buttons: [{ 
		label: "Button 1", 
		handler: function() { console.log('Button 1 handler'); } 
	}, { 
		label: "Button 2", 
		handler: function() { console.log('Button 2 handler'); } 
	}],
	blocking: false

});

Open the example on JSFiddle.

See also

All events