これは本当に簡単なことだと思いますが、うまくいかないようです。「時間」選択リストがあり、各オプションに「rel」という番号が付いています。ユーザーが時間選択を変更した場合、選択内容に応じて新しいオプションのリストを表示したいと思います。それが理にかなっているなら?
これが私の最初の選択です:
<select name="time" id="time">
<option value="7:00am" rel="10">7:00am</option>
<option value="12:30pm" rel="16">12:30pm</option>
</select>
ユーザーが午前7:00を選択した場合、1から10までのオプションを提供する新しいオプションリスト(jqueryを使用)が必要です。
<select name="quantity" id="quantity">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
............................
<option value="10">10</option>
</select>
これが私がこれまでに持っているものです...
<script type="text/javascript" language="javascript">
jQuery("#time").change(function(){
var positions = jQuery("#time :selected").attr("rel"); //this grabs the rel from time
//this is where it should create a list of options to append(??) to the select list..
jQuery("#showQuantity").show(); //this shows the hidden field for quantity
});
</script>
私はそれが理にかなっていることを願っていますが、私はそれに固執しています。前もって感謝します :)