Skip to content

Selector class

Andrey Poprotsky edited this page Apr 22, 2019 · 4 revisions

Selector class functionality in evente is based on querySelectorAll function and Array class. If you are using jQuery note that some selectors are provided by jQuery extensions (see Links section below) but evente not supported them.

Methods

constructor

Parameters

  1. CSS selector or array of HTMLElement objects or single HTMLElement object
  2. Selector object which is base for new object

Returned value

Selector object

addClass

Parameters

  1. String of CSS classes separated by space symbol or array of strings of CSS classes

Returned value

this

attr

Parameters

  1. String contained attribute name
  2. New value of attribute (optional)

Returned value

  • Method called with only first parameter returns array of attribute's values or value of attribute if Selector object contains only one element
  • Method called with both parameter returns this

Usage

let inputs = new rl.Selector('input');

or

let inputs = rl('input');

or if you do not use jQuery

let inputs = $('input');

also creates instance of Selector class.

Links

jQuery Selector Extensions

Clone this wiki locally