JavaScript Training
Goal Trainers Format
• Lecture• Exercises• Ask Questions!• bitovi/js-training
Attributes and Properties
get/set Element properties
element.getAttribute( attributeName )element.setAttribute( attributeName , value )element.removeAttribute( attributeName )
element.idelement.classNameanchor.hrefinput.type
Exercise
Add an attr method to $ that gets/sets attributes:
$('ul li a').attr('class', 'active');
$('ul li a').attr('href') //-> '#Doberman'