TinyMCE:API/tinymce/each

From Moxiecode Documentation Wiki

Jump to: navigation, search

Contents

Method: each

Summary

Performs an iteration of all items in a collection such as an object or array. This method will execure the callback function for each item in the collection, if the callback returns false the iteration will terminate. The callback has the following format: cb(value, key_or_index).

Syntax

<void> each(<Object> o, <function> cb, <Object> s)

Parameters

o
Collection to iterate.
cb
Callback function to execute for each item.
s
Optional scope to execute the callback in.

Examples

// Iterate an array
tinymce.each([1,2,3], function(v, i) {
   console.debug("Value: " + v + ", Index: " + i);
});

// Iterate an object
tinymce.each({a : 1, b : 2, c: 3], function(v, k) {
   console.debug("Value: " + v + ", Key: " + k);
});
Personal tools