Modifying elements topic
After selecting elements, use the selection to modify the elements. For example, to set the class and color style of all paragraph elements in the current document:
d4
.selectAll("p".u31)
.attrSet("class", "graf".u22)
.styleSet("color", "red".u22);
Selection methods typically return the current selection, or a new selection, allowing the concise application of multiple operations on a given selection via method chaining. The above is equivalent to:
final p = d4.selectAll("p".u31);
p.attrSet("class", "graf".u22);
p.styleSet("color", "red".u22);
Selections are immutable. All selection methods that affect which elements are selected (or their order) return a new selection rather than modifying the current selection. However, note that elements are necessarily mutable, as selections drive transformations of the document!
Extensions
- SelectionAppend on Selection
- SelectionAppend on Selection
- SelectionAppend on Selection
- SelectionAttr on Selection
- SelectionAttr on Selection
- SelectionAttr on Selection
- SelectionClassed on Selection
- SelectionClassed on Selection
- SelectionClassed on Selection
- SelectionClone on Selection
- SelectionClone on Selection
- SelectionClone on Selection
- SelectionHtml on Selection
- SelectionHtml on Selection
- SelectionHtml on Selection
- SelectionInsert on Selection
- SelectionInsert on Selection
- SelectionInsert on Selection
- SelectionLower on Selection
- SelectionLower on Selection
- SelectionLower on Selection
- SelectionOrder on Selection
- SelectionOrder on Selection
- SelectionOrder on Selection
- SelectionProperty on Selection
-
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’schecked
boolean. Use this extension to get or set these properties. - SelectionProperty on Selection
-
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’schecked
boolean. Use this extension to get or set these properties. - SelectionProperty on Selection
-
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’schecked
boolean. Use this extension to get or set these properties. - SelectionRaise on Selection
- SelectionRaise on Selection
- SelectionRaise on Selection
- SelectionRemove on Selection
- SelectionRemove on Selection
- SelectionRemove on Selection
- SelectionSort on Selection
- SelectionSort on Selection
- SelectionSort on Selection
- SelectionStyle on Selection
- SelectionStyle on Selection
- SelectionStyle on Selection
- SelectionText on Selection
- SelectionText on Selection
- SelectionText on Selection
Functions
-
create(
String name) → Selection - Given the specified element name, returns a single-element selection containing a detached element of the given name in the current document.
-
create(
String name) → Selection - Given the specified element name, returns a single-element selection containing a detached element of the given name in the current document.
-
create(
String name) → Selection - Given the specified element name, returns a single-element selection containing a detached element of the given name in the current document.
-
creator(
String name) → Element Function(Element, [JSAny?, int?, List< Element?> ?]) -
Given the specified element name, returns a function which creates an
element of the given name, assuming that
thisArg
is the parent element. -
creator(
String name) → Element Function(Element, [JSAny?, int?, List< Element?> ?]) -
Given the specified element name, returns a function which creates an
element of the given name, assuming that
thisArg
is the parent element. -
creator(
String name) → Element Function(Element, [JSAny?, int?, List< Element?> ?]) -
Given the specified element name, returns a function which creates an
element of the given name, assuming that
thisArg
is the parent element.