0

I am trying to implement a chained select dependent on 2 parent selects, but the child select always remains disabled, with no options loading. As far as I can tell, the first-parent\second-parent format is correct in my data, but yet the child select won't fire.

My setup is as follows:

  • 1st parent select: years (year-2016, year-2015, year-2014...)
  • 2nd parent select: media types (article, gallery, video)

If "year-2015" and "article" are selected, then the child select should display options with the class "year-2015\article".

Scripts:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="jquery.chained.js"></script>
<script>$("#item").chained("#year, #mediatypes");</script>

Here is a jsfiddle with the generated HTML

My code seems to be consistent with this example fiddle -- but I can't identify why my child select won't fire. What am I missing?

4

1 に答える 1

0

これを投稿するのに時間がかかった直後に問題を発見しました...

クラスを間違った順序で配置していました。私の子供は、「記事\年-2015」ではなく「年-2015\記事」としてフォーマットされた必要なクラスを選択します。単純なエラーですが、他の誰かが同じ間違いを犯した場合に備えて、質問に「答えています」。

于 2016-05-20T23:13:20.130 に答える