每當(dāng)我單擊提交按鈕時(shí),它應(yīng)該使用數(shù)據(jù)庫中給出的所需值來驗(yàn)證答案。我該如何解決這個(gè)錯(cuò)誤?該按鈕執(zhí)行包含表和行的表單提交。我已經(jīng)包含了一段代碼。<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script><button type="submit" id="btn1" onclick="getanswer();"> submitanswer </button><tr> <td>{{Result.id}} ) {{Result.questions}}</td></tr><tr> <td><input type="radio" id="choice1" name="{{Result.id}}" class="ans" value="{{Result.choice1}}">{{Result.choice1}}</td></tr>$(document).ready(function() { $("#btn1").click(function() { $(".btn1").show(); $(".btn1").attr("disabled", true); });});function getanswer() { document.getElementById("useranswer").innerHTML = ""; var e = document.getElementsByTagName('input'); for (i = 0; i <= e.length; i++) { if (e[i].type == 'radio') { if (e[i].checked) { document.getElementById("useranswer").innerHTML += "Q" + e[i].name + "Answer you selected is :" + e[i].value + "<br/>"; } } }}
(index):40 未捕獲類型錯(cuò)誤:無法在 HTMLButtonElement
人到中年有點(diǎn)甜
2023-09-07 14:33:15