Wednesday, October 25, 2017

Use .remove in JavaScript to remove an item from a dropdown list at a particular position.

Do not try to do a .slice against the options array, instead something like this is more applicable, perhaps for removing that "PLEASE MAKE A SELECTION" default value after someone actually makes a selection:

if(this.foo.nativeElement.options[0].text == this.select){
   this.foo.nativeElement.remove(0);
}

No comments:

Post a Comment