For a project at The Job recently, I needed to do the time-honored trick of changing the contents of a select box based on the selection chosen in another. Straightforward enough, I guess. I based mine on an idea of sabithpocker on Stack Overflow, which clones all of the options, then filters them based on the criteria given — in this case, the value of the selected “trigger” index.
But I needed something more extensible once it was suggested in a meeting that we needed two filtered drop-downs based on the first. This is what I came up with.
