dropdown.settings.remove

getDropDown(id).settings.remove("option")

Removes a single option from the list. Nothing happens if the option passed as an argument is in fact not in the list.

Example:

[js highlight=”17,18″ try=”true”]newDropDown(“value” , “Truth value”)
.settings.add( “True” , “False” )
.print()
,
newScale(“logic”, “Binary”,”Three-valued”)
.settings.default(“Binary”)
.settings.before( newText(“Logic: “) )
.settings.labelsPosition(“right”)
.settings.callback(
getScale(“logic”)
.test.selected(“Three-valued”)
.success(
getDropDown(“value”)
.settings.add(“Other”)
)
.failure(
getDropDown(“value”)
.settings.remove(“Other”)
)
)
.print()[/js]

Creates a drop-down list with two options, True and False, and prints it onto the page. Then creates a Scale element with two options, Binary and Three-value, the former being selected by default, preceded with the text Logic:. Whenever a value gets selected on the Scale, a test checks whether the selected value corresponds to Three-valued and, if so, it adds the option Other to the drop-down list, or removes it from the list otherwise.