DOMInput generates HTML form control elements as strings: <input>, <textarea>, <select>, <option>, and <optgroup>. Unlike most DOM helper classes, DOMInput is configured at construction time — the id, style options, and extra props you pass to the constructor apply to every element created from that instance.
Import
Constructor
The
id attribute applied to the generated element. Pass an empty string "" for elements that should not have a specific id (e.g., individual option elements).Style options —
classes, style, disableDefaultClass. Applied to every element created from this instance.Extra HTML attributes merged into every element, such as
placeholder, required, disabled, name, or aria-label.DOMInput extends DOM with selfCloseTag = true, so createInput() produces self-closing <input /> elements. createSelect(), createOption(), and createOptgroup() handle their own closing tags explicitly.Methods
createInput
Creates a self-closing <input /> element.
The HTML input type:
"text", "password", "email", "number", "checkbox", "radio", etc.createTextarea
Creates a <textarea> element. All style and prop configuration comes from the constructor.
createSelect
Creates a <select> dropdown element with its child <option> and <optgroup> elements. Optionally accepts a change handler.
The option or optgroup elements — output of
createOption() or createOptgroup().An optional change event handler serialized and attached as
onChange. Runs in the plugin iframe context — you can access document from within it.createOption
Creates an <option> element for use inside a <select>.
The visible text shown in the dropdown.
The value submitted when this option is selected.
Whether this option is pre-selected. Defaults to
false.Additional HTML attributes, such as
disabled.createOptgroup
Creates an <optgroup> element that groups related options under a label.
The group heading shown in the dropdown (rendered as the
label attribute).option elements created with createOption().Additional HTML attributes, such as
disabled.