TinyMCE:API/tinymce/each
From Moxiecode Documentation Wiki
< TinyMCE:API | tinymce
Contents |
[edit]
Method: each
[edit]
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).
[edit]
Syntax
<void> each(<Object> o, <function> cb, <Object> s)
[edit]
Parameters
- o
- Collection to iterate.
- cb
- Callback function to execute for each item.
- s
- Optional scope to execute the callback in.
[edit]
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);
});
