D3

##Selectors

//add class
d3.selectAll('.foo').classed('foobar', true);
//remove class
d3.selectAll('.foo').classed('foobar', false);

##Attribute and Style update

//set attribute
d3.selectAll('.foo').attr('data-type', 'foobar');
//set css style
d3.selectAll('.foo').style('background-color', '#666');

##AJAX js d3.json('http://url-to-resource.json', doSomething); d3.text('http://url-to-resource.txt', doSomething);

##Append & Prepend

d3.selectAll('.foo').append('div');
d3.selectAll('.foo').insert('div');

##Event Listening

d3.selectAll('.foo').on('click', clickHandler);

##Remove Elements js d3.selectAll('.foo').remove();

##Subselect js d3.selectAll('.foo').selectAll('.bar'); //similar to jQuery's find

##Content Manipulation js d3.selectAll('.foo').text('Hello World!'); d3.selectAll('.foo').html('<div class="bar">Hello World!</div>');