DiviAreaItem.hasId()

  1. Home
  2. Knowledge Base
  3. Codex
  4. JS API
  5. JS Functions
  6. DiviAreaItem.hasId()
DiviAreaItem.hasId(id)

Returns true, when the current Area has the specified ID.

Recognized IDs:

Numeric post
(e.g. "2520")
Prefixed CSS
(e.g. "divi-area-2520")
– Area Slug (e.g. `”contact-form”`) – Prefixed Area Slug (e.g. `”divi-area-contact-form”`)
CSS
of inline Popups, free plugin (e.g. "#learn-more")

Params

id
(string, required) The ID to test against the current Area instance.

Returns

Returns boolean true when the given ID is associated with the Area instance. Otherwise, the return value is false.

Examples

// Get the Area with ID 74335, which has the slug "sample".
var area = DiviArea.getArea('divi-area-74335');

console.log( area.hasId('#divi-area-74335') );  // true
console.log( area.hasId('divi-area-74335') );   // true
console.log( area.hasId('74335') );             // true
console.log( area.hasId('#divi-area-sample') ); // true
console.log( area.hasId('divi-area-sample') );  // true
console.log( area.hasId('sample') );            // true

Notes

No notes

Was this article helpful?

Related Articles