私はselectこのようなものを持っています:
<select id="address">
<option noodd="1-9" noeven="2-6">Address Name 1</option>
<option noodd="3-5" noeven="2-10">Address Name 2</option>
<option noodd="3-11" noeven="1-5">Address Name 3</option>
</select>
<select id="housenumber">
</select>
のオプションの1つを選択するときはいつでも、選択したアドレスの範囲内の番号を入力する#address必要があります。#housenumberしたがって、Address Name 1が選択された場合、次#housenumberのようになります。
<select id="housenumber">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>9</option>
</select>
誰かがそれを行う方法について賢い考えを持っていますか?
更新、私が必要なのはこれです:
noeven各に指定された数の間のすべての等しい数を見つける関数option。noodd各に指定された数の間のすべての奇数を見つける関数option。optionこれら2つのリストを組み合わせて要素に入れる関数- 対応するinが選択されるたびにこれらの
option要素を追加する関数#housenumberoption#address