tuupola/jquery_chained

optgroup instead of class names

Opened this issue · 0 comments

Hi there - I think this is different from the 'support optgroup' issue.
What I'm thinking is that instead of classnames as the hook for the secondary chained select box, it would be more semantic, cleaner and attractive I think to use optgroup for this.
For example:

<select id="mark" name="mark">
    <option value="">--</option>
    <option value="bmw">BMW</option>
    <option value="audi">Audi</option>
</select>
<select id="series" name="series">
    <optgroup label="BMW">
        <option value="series-3">3 series</option>
        <option value="series-5">5 series</option>
        <option value="series-6">6 series</option>
    </optgroup>    
    <optgroup label="Audi">
        <option value="a3">A3</option>
        <option value="a4">A4</option>
        <option value="a5">A5</option>
    </optgroup>    
</select>

For gracefull degradation It would be necessary to match the label to the selected TEXT not the VALUE ot the parent select box.