Skip to content

Commit fe0f15b

Browse files
authored
Merge pull request #5777 from ggorlen/clarify-select-option
Clarify select option behavior
2 parents 69fd5e9 + 0cc10c4 commit fe0f15b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/dom/dom.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,8 @@ p5.prototype.createCheckbox = function() {
622622

623623
/**
624624
* Creates a dropdown menu `<select></select>` element in the DOM.
625-
* It also helps to assign select-box methods to <a href="#/p5.Element">p5.Element</a> when selecting existing select box.
626-
* - `.option(name, [value])` can be used to set options for the select after it is created.
625+
* It also assigns select-related methods to <a href="#/p5.Element">p5.Element</a> when selecting an existing select box. Options in the menu are unique by `name` (the display text).
626+
* - `.option(name, [value])` can be used to add an option with `name` (the display text) and `value` to the select element. If an option with `name` already exists within the select element, this method will change its value to `value`.
627627
* - `.value()` will return the currently selected option.
628628
* - `.selected()` will return the current dropdown element which is an instance of <a href="#/p5.Element">p5.Element</a>.
629629
* - `.selected(value)` can be used to make given option selected by default when the page first loads.

0 commit comments

Comments
 (0)