select

Better select widgets in vanilla javascript.  https://p.ce9e.org/select/demo/
git clone https://git.ce9e.org/select.git

commit
67c98349e6e3a052224bb1233873439087c53784
parent
03b46bea64755d3613ea4fa53e9f08f51ccfdbd3
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2022-07-26 15:24
reset custom validity on setValue

Diffstat

M select.js 2 ++

1 files changed, 2 insertions, 0 deletions


diff --git a/select.js b/select.js

@@ -104,6 +104,7 @@ export class Select {
  104   104 	updateValue() {
  105   105 		if (this.original.multiple) {
  106   106 			this.input.value = '';
   -1   107 			this.input.setCustomValidity('');
  107   108 			this.values.innerHTML = '';
  108   109 			Array.from(this.original.options).forEach((op, i) => {
  109   110 				if (op.selected && op.label) {
@@ -121,6 +122,7 @@ export class Select {
  121   122 		} else {
  122   123 			if (this.original.selectedOptions.length) {
  123   124 				this.input.value = this.original.selectedOptions[0].label;
   -1   125 				this.input.setCustomValidity('');
  124   126 			}
  125   127 		}
  126   128 	}