Description

Find a child by attribute. Returns an array of element found

Usage

Parameters

  • attr {String}

    Attribute name

  • val {Object} optional

    (optional) Attribute value

Returns

Array

Example

In method ready

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

el1.attr('prop', 'one');
el2.attr('name', 'foo');
el3.attr('name', 'bar');

stage.append(el1, el2, el3);

stage.findAttr('name'); // returns el2 and el3 elements
stage.findAttr('name', 'foo'); // returns el2 element

Discussion