element attributes and properties

Post on 17-Aug-2015

90 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

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'

top related