selection.property(name[, value])
Some HTML elements have special properties that are not addressable using attributes or styles, such as a form field’s text value
and a checkbox’s checked
boolean. Use this method to get or set these properties.
If a value is specified, sets the property with the specified name to the specified value on selected elements. If the value is a constant, then all elements are given the same property value; otherwise, if the value is a function, then the function is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element. The function’s return value is then used to set each element’s property. A null value will delete the specified property.
If a value is not specified, returns the value of the specified property for the first (non-null) element in the selection. This is generally useful only if you know the selection contains exactly one element.
Please login to continue.