【发布时间】:2017-08-04 09:25:01
【问题描述】:
请帮我简化这段代码我有一个测验项目,你选择一个答案,答案将附加到 .response 类
Appology 作为我之前的问题还不清楚。我是 jQuery 新手,因此非常感谢您的帮助。
这是场景,我在 div id="scenarioCont" 下有 28 组组项/字段集。 每个 div class="scenario"
有 7 个字段集<div id="scenarioCont">
<div class="scenario">
<fieldset id="group1">
<p>Question #1 </p>
<p><input type="radio" class="scenarioRadio" value="Strongly agree" name="group1" /><label>Strongly agree </label></p>
<p><input type="radio" class="scenarioRadio" value="Somewhat agree" name="group1" /><label>Somewhat agree </label></p>
<p><input type="radio" class="scenarioRadio" value="Neither agree or disagree" name="group1" /><label>Neither agree or disagree</label></p>
<p><input type="radio" class="scenarioRadio" value="Somewhat disagree" name="group1" /><label>Somewhat disagree</label></p>
<p><input type="radio" class="scenarioRadio" value="Strongly disagree" name="group1" /><label>Strongly disagree </label></p>
<p><input type="radio" class="scenarioRadio" value="Don’t know / Can’t say" name="group1" /><label>Don’t know / Can’t say</label></p>
</fieldset>
<fieldset id="group2">
<p>Question #1</p>
<p><input type="radio" class="scenarioRadio" value="Yes, always" name="group2" /><label>Yes, always </label></p>
<p><input type="radio" class="scenarioRadio" value="Yes, usually" name="group2" /><label>Yes, usually</label></p>
<p><input type="radio" class="scenarioRadio" value="Yes, sometime" name="group2" /><label>Yes, sometimes </label></p>
<p><input type="radio" class="scenarioRadio" value="No" name="group2" /><label>No</label></p>
<p><input type="radio" class="scenarioRadio" value="Don’t know" name="group2" /><label>Don’t know</label></p>
</fieldset>
<fieldset id="group6">...</fieldset>
<fieldset id="group7">...</fieldset>
</div>
<div class="scenario">
<fieldset id="group8">...</fieldset>
...
<fieldset id="group14">...</fieldset>
</div>
<button type="button" style="float:left;" class="buttonStyle" id="prevScenario" disabled="true">Back</button>
<button type="button" style="float:right;" class="buttonStyle" id="nextScenario" disabled="true">Next</button> **will change to submit after the last slide/panel item
</div>
选择下一步会显示下一组问题。
<button type="button" style="float:right;" class="buttonStyle" id="nextScenario" disabled="true">Submit</button>
然后选择 提交 开始投票计算。所有选择的答案都应显示在 span class="response"
<table id="resultsTable">
<tr id="group1">
<td class="responseCell"><span class="response">(the answer in group 1 should display here)</span></td>
</tr>
<tr id="group2">
<td class="responseCell"><span class="response">(the answer in group 2 should display here)</span></td>
</tr>
.....
</table>
提前谢谢你们!
【问题讨论】:
-
HTML 中的标识符必须是唯一的,先更正一下
-
IDK 你想做什么。请正确描述。你想做的。并把你的代码像(HTML、CSS、JQuery 等)