Skip to content

Is there a way to make dependent dropdowns? #154

Answered by sa-si-dev
hassanjrao asked this question in Q&A
Discussion options

You must be logged in to vote

@hassanjrao it has to be handled in your project code.

Use change event listener for first drop-down and update the value for second drop-down on first drop-down change.

document.querySelector('#sample-select1').addEventListener('change', function () {
  const firstValue = this.value;
  const secondValue = 'set value for second dropdown based on firstValue';

  document.querySelector('#sample-select2').setValue(secondValue);
});

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sa-si-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants