There are no tracking or monitoring cookies on this site. There are only cookies used for documentation examples related to cookies.Close
Processing...
This may take a few seconds.

if-empty

Syntax

if-empty: ["]variable|element selector["];

This conditional action will return true if the string variable evaluated is empty, ie. a string length of zero.

variable = The variable or variable combination you want to check. This can be any valid Active CSS variable, either an attribute, or an ajax response variable. The variable needs to be existing in the call flow for it to be substituted correctly. Ie. for an ajax response variable, you could use this as a conditional in an afterAjax declaration. Referring to an attribute in a conditional will always grab the attribute from the event selector. Optional double-quotes for readability.

element selector = reference to an element. If the element is an input tag, it will take its value. If it is a textarea tag, it will take its content. Any other type of selector it will check its innerText.

This example will return true if the variable ${success} is empty, ie. there is no variable there or if it is an empty string.

@conditional ajaxSuccess {
    if-empty: {success};
}

Ths example will return true if the variable {@data-title} is an empty string or not present. Remember, the attribute in a conditional will always be substituted in from the event selector.

@conditional hasTitle {
    if-empty: {@data-title};
}

if-empty