似乎在演示here上运行良好的图书馆正是我想要实现的目标。
我正在尝试使用'class'方法进行多层链式选择。
我希望这不是一个简单的错误,我一整天都在努力工作,几乎没有成功。
我在jsfiddle上有一个例子。
HTML
<div id="#time-entry-input-table">
<form>
<select id="user-select" name="user-select">
<option value=" ">--</option>
<option id="user-select-1" value="user-select-1">User A</option>
<option id="user-select-2" value="user-select-2">User B</option>
<option id="user-select-3" value="user-select-3">User C</option>
<option id="user-select-4" value="user-select-4">User D</option>
</select>
<select id="client-select" name="client-select">
<option value=" ">--</option>
<option id="client-select-1" value="client-select-1">Client A</option>
<option id="client-select-2" value="client-select-2">Client B</option>
<option id="client-select-3" value="client-select-3">Client C</option>
</select>
<select id="job-select" name="job-select">
<option value=" ">--</option>
<option id="job-select-1" value="job-select-1">Job A</option>
<option id="job-select-2" value="job-select-2">Job B</option>
<option id="job-select-3" value="job-select-3">Job C</option>
</select>
<select id="sub-select" name="sub-select">
<option value=" ">--</option>
<option id="sub-select-1" value="sub-select-1">Sub A</option>
<option id="sub-select-2" value="sub-select-2">Sub B</option>
</select>
<select id="rate-select" name="rate-select">
<option value=" ">--</option>
<option id="rate-select-1" value="rate-select-1">Rate A</option>
<option id="rate-select-2" value="rate-select-2">Rate B</option>
<option id="rate-select-3" value="rate-select-3">Rate C</option>
<option id="rate-select-4" value="rate-select-4">Rate D</option>
</select>
</form>
</div>
JS
$('#rate-select-1').addClass('sub-select-1');
$('#sub-select-1').addClass('job-select-2');
$('#job-select-2').addClass('client-select-2');
$('#client-select-2').addClass('user-select-1'); <-- typo was here... fixed
$('#client-select').chained('#user-select');
$('#job-select').chained('#client-select');
$('#sub-select').chained('#job-select');
$('#rate-select').chained('#sub-select');