0
$('td.qid').text().
上面的代碼將確定警報所引用的行。下面是警覺的樣子:我在哪裏放置此代碼,以便它出現在警報中
You have not entered a valid Question
Please Enter in the Number of Answers you Require for this question
Please enter in a figure for Number of Marks for this Question
我想提醒的樣子如下:
You have errors on question number: 1
You have not entered a valid Question
Please Enter in the Number of Answers you Require for this question
Please enter in a figure for Number of Marks for this Question
我的問題是,我在哪裏把「你有問題,一些錯誤」,代碼$('td.qid').text()
在下面的函數中能夠顯示警報頂部的'您在問題編號上有錯誤:1'?
下面是驗證功能:
var qnum = 1;
function insertQuestion(form) {
var $tbody = $('#qandatbl > tbody');
var $tr = $("<tr class='optionAndAnswer' align='center'></tr>");
var $qid = $("<td class='qid'>" + qnum + "</td>");
$tr.append($qid);
$tbody.append($tr);
$(form).find('.numberOfQuestions').val(qnum);
++qnum;
$("#questionNum").text(qnum);
}
感謝