链接选择使用jquery.chained.min.js不起作用 [英] chaining select using jquery.chained.min.js does not work

查看:118
本文介绍了链接选择使用jquery.chained.min.js不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图链选择,如下所示。问题是它不起作用。例如,当我选择VIC时,VIC下的那个不显示出来?

I am trying to chain select as can be seen in the following. The problem is it is not working. When I select VIC for instance, the ones under VIC does not show up?

我是使用jquery.chained.min.js 从这里 http://www.appelsiini.net/projects/chained

由于代码非常大,只需在下面添加部分代码即可。完整的代码是ast jsfiddle http://jsfiddle.net/8gUw4/1/

As the code is really large just adding parts of it below. Complete code is ast jsfiddle http://jsfiddle.net/8gUw4/1/

$("#custom1").chained("#state");  

以上是js代码,下面是其中一个选择

Above is the js code and below is one of the select

<select id="state" name="state">
    <option value="">--</option>
    <option value="ACT">ACT</option>
    <option value="NSW">NSW</option>
    <option value="NT">NT</option>
    <option value="QLD">QLD</option>
    <option value="SA">SA</option>
    <option value="TAS">TAS</option>
    <option value="VIC">VIC</option>
    <option value="WA">WA</option>
</select>

另一个选择类似于

The other select looks similar to below

<select id="custom1" name="custom1">
  <option value="">--</option>
  <option  value="199346" class="ACT">Ainslie (IGA Ainslie )</option>
  <option  value="182755" class="ACT">Banks (IGA Banks )</option>
  <option  value="182315" class="ACT">Canberra City (City West Carpark IGA Plus Liquor )</option>
  <option  value="182056" class="ACT">Canberra City (IGA X-press East Row )</option>
  <option  value="179370" class="ACT">Chapman (IGA Chapman )</option>
  <option  value="198308" class="ACT">Deakin (IGA Deakin )</option>
  <option  value="171479" class="ACT">Evatt (IGA Evatt )</option>
.....

</select>


推荐答案

小提琴似乎对我有用。我选择VIC并显示class =VIC的选项。

The fiddle seems to be working to me. I select VIC and the options with class="VIC" show up.

也许你看到的问题是一些没有 VIC 类的选项也显示向上。这可能是因为那些显示出来的价值是空的。我的猜测是,链接按值筛选选项,因此无法使用空值筛选选项。

Perhaps the problem you're seeing is that some options that don't have a class of VIC also show up. This is probably because the ones that show up have an empty value. My guess is that chained filters the options by value, so it is unable to filter the ones with empty values.

这篇关于链接选择使用jquery.chained.min.js不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆