我有一个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>
Whenever one of the options in #addressis selected, I need #housenumberto be filled with the numbers within the ranges of the address selected. 所以当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元素的函数 - A function that appends these
optionelements to#housenumberwhenever the correspondingoptionin#addressis selected