Skip to content

Attr Parser

Malexion edited this page Nov 6, 2016 · 1 revision

new __.lib.AttParser([options])

  • [options] [Optional] Options param, {...} key - value groups for attributes.

Examples

var attr = new __.lib.AttrParser({ class: 'btn btn-default' });

attr.update({ 
   class: 'btn btn-success', 
   id: 'mybtn', 
   title: 'This is my btn', 
   style: 'width: 50%;' 
});
attr['style'] = 'width: 100%;';
attr.remove('title');
attr.update('id="mySampleBtn"');

console.log(attr.asString);
console.log(attr.asObject);

attr.clear();
console.log(attr.asString);

Clone this wiki locally