DiviAreaItem.get()

  1. Home
  2. Knowledge Base
  3. Codex
  4. JS API
  5. JS Functions
  6. 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