Referenceselect

<select>

<select> selects values from a list or from a group of nested <option> components at random and assigns them names using the assignNames attribute.

Attributes and Properties

Attributes for <select>
AttributeTypeValues
addLevelToAssignNames = "…""true" "false"
asList = "…""true" "false"
assignNames = "…"
assignNamesSkip = "…"
numToSelect = "…"integer
type = "…"
withReplacement = "…"boolean"true" "false"
Props for <select name="s">
PropertyType
$s.numToSelectinteger
$s.withReplacementboolean

Example: Default <select>

The default selection type is math. If options are simple math expressions these can be placed in a space-selected list between the opening and closing <select> tags.


Example: <select> from a set of texts

A text is selected from a group of options.


Example: <select> components of multiple types

Multiple component types can be selected together and given individually assigned names. In this case, the components should be defined by type within the <option> block.


Example: <select> paired values

In this example, two pairs of named values are assigned with the <select> component. When values are to be grouped for selection, they should be enclosed in parentheses in the assignNames attribute. In this example, all selections are made from the same <option> component, but results are varied because each selection item is a <selectFromSequence/>{:dn} component. The first “die value” in each roll of two dice is chosen from the first <selectFromSequence/>, and the second “die value” is determined by the second <selectFromSequence/>, for both of the “rolls” selected.

Select a new page variant to see different variants of the document.


Example: <select> random functions for graphing

In this example, two <function>s are randomly selected from a list of <option> components nested within a <select>. The final functions are further varied by specifying coefficients and constants that have been generated using a <selectFromSequence/>{:dn} component.

Select a new page variant to see different variants of the document.


Example: assignNames

The assignNames attribute allows you to specify names for values selected with a <select>.


Example: numToSelect

The <select> component is used to randomly select three <math> values and assign them names using the numToSelect attribute. Different page variants (which can be accessed from the left-side menu) will have different selected <math> values.


Example: withReplacement

Use the withReplacement attribute if the options listed may be selected more than once.


Example: type

The type attribute alerts Doenet to the type of component to select. The default type is math; therefore, text will render as math unless otherwise specified.