d3.js Selections Different selectors


Example

You can select elements with different selectors :

  • by tag : "div"
  • by class : ".class"
  • by id : "#id"
  • by attribute : "[color=blue]"
  • multiple selectors (OR): "div1, div2, class1"
  • multiple selectors (AND): "div1 div2 class1"