Description

(>=1.3.1) Gets the next element. It is possible to filter on an attribute. Return false if the element was not found

Usage

Parameters

  • attr {String} optional

    (optional) Attribute name

  • val {Object} optional

    (optional) Attribute value

Returns

CanvasEngine.Element|Boolean

Example

In method ready

var el1 = this.createElement(),
    el2 = this.createElement(),
    el3 = this.createElement(),
    el4 = this.createElement();

el3.attr("foo", "bar");
el4.attr("foo", "yoo");

stage.append(el1, el2, el3, el4);

stage.first().next();               // returns el2 element
stage.first().next("foo");          // returns el3 element
stage.first().next("foo", "yoo");   // returns el4 element
stage.first().next("foo", "hi");    // returns false

Discussion