class VisibilitySelect extends View { /** * Getter for the select's value. */ get value() { return this.select.value; } /** * Setter for the select's value. */ set value(value) { this.select.value = value; } constructor(element) { super(element); } build(element) { //Label. this.label = document.createElement("label"); this.label.for = "category-visibility-select"; this.label.className = "field-label"; this.label.innerText = "Visible to "; element.appendChild(this.label); //Select. this.select = document.createElement("select"); this.select.id = "category-visibility-select"; element.appendChild(this.select); //Add options. var options = { 1: "everyone", 0: "only me" }; for (const value in options) { const option = document.createElement("option"); option.value = value; option.innerText = options[value]; this.select.appendChild(option); } return element; } } UIKit.registerViewType(VisibilitySelect, "visibility-select");