element attributes and properties

4
JavaScript Training Goal Trainers Format Lecture Exercises Ask Questions! bitovi/js-trainin

Upload: alexisabril

Post on 17-Aug-2015

90 views

Category:

Technology


1 download

TRANSCRIPT

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'