Skip to content
scribu edited this page Jul 30, 2012 · 10 revisions

Initialise dynamic content

When the page loads, FEE initialises all the editable fields marked with .fee-field or .fee-group classes.

Some plugins, such as Infinite Scroll, load additional content via AJAX. To make this content editable via FEE, you just need to make a single call:

FrontEndEditor.init_fields();

Start an editor programatically

Here's how you can start editing the first group of elements when the page loads:

jQuery(window).load(function() {
	jQuery('.fee-group').data('fee-editor').start_editing();
});

Editing events

There are a few custom events fired for each editable element during the editing process:

  • 'edit_start' - after the user clicked 'Edit', before getting the data via ajax

  • 'edit_started' - after getting the data and initializing the form

  • 'edit_save' - after the user clicked 'Save', before sending the data via ajax

  • 'edit_saved' - after sending the data and updating the DOM

The following code shows how to access all the available information related to an event:

jQuery(document).bind('edit_saved', function(ev) {
  var el = jQuery(ev.target);

  console.log(el.data('fee-editor'));
});