根据树中的顺序更改元素

时间:2018-03-02 00:21:22

标签: javascript html

我有几个无线电选项(类无线电选项)和价格(类选项价格)列表。我需要显示当前选择的价格," show"我的意思是让它可见(没有不显示)

HTML结构如下:

列表1:

<div class="radio-options" id="options-9-list">
        <input class="radio  name="options[9]" id="options_9_2" value="35" checked="" type="radio"><label class="radio-options__label" for="options_9_2">1 hour</label>
        <input class="radio  name="options[9]" id="options_9_3" value="36" type="radio"><label class="radio-options__label" for="options_9_3">2 hours</label>
        <input class="radio  name="options[9]" id="options_9_4" value="37" type="radio"><label class="radio-options__label" for="options_9_4">3 hours</label>
</div>


<dl class="option-price">
    <dt class="tour-1">
    <dt class="tour-2 no-display">
    <dt class="tour-3 no-display">
</dl>

清单2:

<div class="radio-options" id="options-10-list">
        <input class="radio  name="options[10]" id="options_10_2" value="45" checked="" type="radio"><label class="radio-options__label" for="options_10_2">1 hour</label>
        <input class="radio  name="options[10]" id="options_10_3" value="46" type="radio"><label class="radio-options__label" for="options_10_3">2 hours</label>
        <input class="radio  name="options[10]" id="options_10_4" value="47" type="radio"><label class="radio-options__label" for="options_10_4">3 hours</label>
        <input class="radio  name="options[10]" id="options_10_5" value="48" type="radio"><label class="radio-options__label" for="options_10_5">4 hours</label>
</div>


<dl class="option-price">
    <dt class="tour-4">
    <dt class="tour-8 no-display">
    <dt class="tour-11 no-display">
    <dt class="tour-14 no-display">
</dl>

模式如下,无线电选项中的第一个按钮必须显示期权价格中的第一个价格,无线电选项中的第二个按钮必须显示期权价格中的第二个价格等等。

我如何编写1个函数来涵盖这样的所有列表?无需包含特定选项ID /类(如options_9_2,tour-1等)

p.s列表位于不同的页面上(每页1个列表)。

0 个答案:

没有答案
相关问题