-1

编辑:

这是问题/问题:在第一个示例(场地)中
,Jquery 按钮工作(以 jquery 样式显示,按照jquery 文档中的示例)并且不工作(不以 jquery 样式显示)第二个(无线电)。

我一直试图让 jquery 按钮工作,但我似乎做不到。

我一直在研究这个问题并改编了jfiddle

我确定这一定只是我缺少的一件小事-但是为什么这段代码有效:

<fieldset class="filter_form_fieldset venues">
    <legend class="filter_form_fieldset_legend">Choose a venue type:</legend>
    <input type="checkbox" name="venuetypes[]" id="venue-1" />
    <label for="venue-1">Venue 1</label>
    <input type="checkbox" name="venuetypes[]" id="venue-2" />
    <label for="venue-2">Venue 2</label>
    <input type="checkbox" name="venuetypes[]" id="venue-3" />
    <label for="venue-3">Venue 3</label>
</fieldset>

而这段代码没有?

<tr>
  <td class="goal_row">goal 1: </td> 
  <td id="radio">
    <input id="score_1_1" name="score_1" type="radio" value="1" />
    <label for="score_1">1</label>
    <input id="score_1_2" name="score_1" type="radio" value="2" />
    <label for="score_1">2</label>
    <input id="score_1_3" name="score_1" type="radio" value="3" />
    <label for="score_1">3</label>
    <input id="score_1_4" name="score_1" type="radio" value="4" />
    <label for="score_1">4</label>
    <input id="score_1_5" name="score_1" type="radio" value="5" />
    <label for="score_1">5</label>
  </td>
</tr> 
4

3 回答 3

2

小提琴

将收音机放在一个 div 中,并将 for 值从 name 更改为 id,如下所示

<tr>


<td class="goal_row">goal 1: </td> 
  <td>
      <div id="radio">
          <input id="score_1_1" name="score_1" type="radio" value="1" />
            <label for="score_1_1">1</label>
            <input id="score_1_2" name="score_1" type="radio" value="2" />
            <label for="score_1_2">2</label>
            <input id="score_1_3" name="score_1" type="radio" value="3" />
            <label for="score_1_3">3</label>
            <input id="score_1_4" name="score_1" type="radio" value="4" />
            <label for="score_1_4">4</label>
            <input id="score_1_5" name="score_1" type="radio" value="5" />
            <label for="score_1_5">5</label>
      </div>
  </td>
</tr> 
于 2013-08-23T11:03:50.413 回答
0

试试这个小提琴:需要把radio按钮inside div和设置div idradio

http://jsfiddle.net/DZx3z/61/

于 2013-08-23T11:08:21.977 回答
-1

好,我知道了。其和 id 问题将以下代码放入您的代码中,这将起作用检查此小提琴http://jsfiddle.net/DZx3z/62/

<tr>
  <td class="goal_row">goal 1: </td> 
  <td>
    <div id="radio">
    <input id="score_1_1" name="score_1" type="radio" value="1" />
    <label for="score_1_1">1</label>
    <input id="score_1_2" name="score_1" type="radio" value="2" />
    <label for="score_1_2">2</label>
    <input id="score_1_3" name="score_1" type="radio" value="3" />
    <label for="score_1_3">3</label>
    <input id="score_1_4" name="score_1" type="radio" value="4" />
    <label for="score_1_4">4</label>
    <input id="score_1_5" name="score_1" type="radio" value="5" />
    <label for="score_1_5">5</label>
    </div>
  </td>
</tr> 

你的代码有什么问题:

这是您尝试解决的一个小问题name attr valuefor attr of label这就是为什么不起作用for attr works for id val

于 2013-08-23T11:02:31.827 回答