My Account | Buy CometChat

documentation

setAlert()

setAlert() function assists you to add a popup alert (pink bubble) to modules.

The API

The setAlert() function can be used to add an alert to a module. The input parameters are the module’s short name i.e. the folder name of the module and the number.

jqcc.cometchat.setAlert('MODULENAME','NUMBER');

When NUMBER is set to 0, the alert will disappear.

Sample Code

A suggested use of this function is to check if new notifications have been added to a custom module and then add an alert.

function checkupdates() {
    var newupdates = 0;
    // Code to check if there have been new updates to 'home' module
    // e.g. newupdates = 5;

    if (newupdates) {
        jqcc.cometchat.setAlert('home',newupdates);
    }
}