我试图让我的for循环改变所有的选择但是因为某些原因他们匹配只有第一个工作
<form>
<div id=q uestion>
<ul class="question-list">
<LH id=que>gfh</LH>
<li id="choice-0">
<input type="radio" name="radio" id="choice" data-price="100" value="product1" checked="checked">
<label for="choice1"><span>question 1</span></label>
</li>
<li "choice-1">
<input type="radio" name="radio" id="choice" data-price="110" value="choice2">
<label for="choice2"><span>question 2 </span></label>
</li>
<li "choice-2">
<input type="radio" name="radio" id="choice" data-price="110" value="product3">
<label for="product3"><span>question 3 </span></label>
</li>
<li "choice-3">
<input type="radio" name="radio" id="choice" data-price="110" value="product3">
<label for="product3"><span>question 4 </span></label>
</li>
</ul>
<input type="button" id="jqtest" value="next" onclick=n extQuestion_onclick>
</div>
</form>
这是选择
var allQuestions = [{question: "Who is Prime Minister of the United Kingdom?", choices: ["David Cameron", "Gordon Brown", "Winston Churchill", "Tony Blair"], correctAnswer:0}];
这是不起作用的功能。
$(document).ready(function() {
var currentChoise;
var changeChoice;
for (currentChoise = 0; currentChoise < allQuestions[0].choices.length; currentChoise++) {
$('#que').text(allQuestions[0].question);
$('#choice-' + currentChoise + ' span').text(allQuestions[0].choices[currentChoise]);
};
});
这里是js fiddle http://jsfiddle.net/4ee1552c/
答案 0 :(得分:3)
这里有几件事:
您的输入上有重复ID。 ID始终是唯一的。没有讨论。
除了第一个id=""
之外,您错过了li
个<label for="">
属性。
id=""
适用于唯一的value=""
属性,而不适用于输入 <input type="radio" name="product3" id="product3" data-price="110" value="Tony Blair" />
<label for="product3">question 3</label>
你想要这样的东西:
Sub Open_PowerPoint_Presentation()
'Opens a PowerPoint Document from Excel
Dim objPPT As Object
Dim PPSlide As Object
Set objPPT = CreateObject("PowerPoint.Application")
Set PPSlide = objPPT.Slides(5)
objPPT.Visible = True
'Change the directory path and file name to the location
'of your document
objPPT.Presentations.Open "\\MI-FILESERVE1\Shared Folders\Shared_Business_Dev\assets\Tender Time Allocation Deck.pptx"
PPSlide.Select
End Sub
检查更新后的fiddle。
答案 1 :(得分:2)
注意这里奇怪的事情:
<li "choice-1">
你错过了id
。