我有几个无线电inut领域,具有特定的值,选择时,我想显示一个输入字段,所以我的代码是:jQuery的 - 根据选定的单选按钮显示隐藏字段
<label for="adult">Adult</label>
<input type="radio" name="type" value="45" />
<label>Number</label><input type="text" id="dob" />
<label for="adult">Student</label>
<input type="radio" name="type" value="5" />
<label>D.O.B</label><input type="text" id="dob" />
<label for="adult">Child</label>
<input type="radio" name="type" value="5" />
<label>D.O.B</label><input type="text" id="dob" />
您可以看到Student
和Child
按钮都有一个D.O.B
字段。我需要隐藏它,并且只有在选择了所选收音机时才会显示。
我最大的问题是,两者都有相同的value
(这是基于价格,这是相同的)。
我将如何定位每个特定的电台来显示D.O.B
字段?我可以向每个人添加一个类/标识并以这种方式定位它们吗?
感谢
你是对的...按类别访问它们 – 2011-05-04 11:18:04
ID必须是唯一的! – 2011-05-04 11:19:11