Slightly nicer PoC.

This commit is contained in:
PeekabooSteam
2023-04-04 23:38:08 +01:00
parent 6f64bd1622
commit 071942b632
8 changed files with 122 additions and 49 deletions

View File

@@ -54,6 +54,15 @@ export class Dropdown {
}));
}
selectText( text:string ) {
const index = [].slice.call( this.#options.children ).findIndex( ( opt:Element ) => opt.querySelector( "button" )?.innerText === text );
if ( index > -1 ) {
this.selectValue( index );
}
}
selectValue(idx: number)
{
if (idx < this.#optionsList.length)