doAction( “init_area” )

  1. Home
  2. Knowledge Base
  3. Codex
  4. JS API
  5. JS Actions
  6. doAction( “init_area” )
DiviArea.doAction( 'init_area', area );
DiviArea.doAction( 'init_area_{id}', area );

Fired right after an area was fully initialized and is ready to be displayed.

The {id} part in the hook name is the sanitized area-ID (all lower case, dashes changed to underscores).


(DiviAreaItem) The initialized Area object.


// Output a console comment upon initializing an Area.
DiviArea.addAction( 'init_area', function( area ) {
    var areaKey = area.getKey();
    console.log( 'Area is ready:', key );

// Instantly display the Divi Area with the ID "safety-notice".
// Notice, how the ID "safety-notice" changes to "safety_notice" in the hook name!
DiviArea.addAction( 'init_area_safety_notice', function( area ) { 'safety-notice' );


At this stage, the Area is detached from the DOM and not visible. This is the earliest point when can display the area.

Was this article helpful?

Related Articles