Skip to content

Chained Select Examples

Static Chain: Country, State, City

A three-level chain using inline static data:

AJAX Chain

A three-level chain that loads options from API endpoints:

Two-Level Chain: Category and Subcategory

A simpler two-level chain:

Chain with Pre-Selected Values

Pre-populate a chain for editing an existing record:

Listening for Chain Events

html
<script>
  const chain = DotSelect.chain('location');

  chain.onChange((index, value, instance) => {
    console.log(`Level ${index} changed to "${value}"`);
  });

  chain.whenReady(() => {
    console.log('All levels ready. Values:', chain.getValues());
  });
</script>

MIT Licensed