DiviAreaItem.get()

DiviAreaItem.get(selector)

Returns a jQuery element of the current area.

When no selector is specified, then the area element is returned, otherwise the result of the selector is returned. The result is always a jQuery object.

This method can be used to access elements inside the Area, even when the Area is not attached to the document (i.e., not visible).

Params

selector string, optional
The selector to find an element inside the area. When omitted, the Area element itself is returned.

Returns

A jQuery object. Either the Area element itself, or an element/list of elements inside the Area.

Examples

// Get a Divi Area instance.
var area = DiviArea.getArea();

// Get the jQuery element of the Area and add a CSS class to it.
var element = area.get();
element.addClass('sample-class');
// Get a Divi Area instance.
var area = DiviArea.getArea();

// Add inline CSS to all p-tags inside the Area.
var elements = area.get('p');
elements.css('color', 'red');

Notes

No notes

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Get in touch with us