How to display table row number in the alert
<p>Below is my validation function:</p>

<pre><code>function validation() {


    alertValidation= "";
        // Note, this is just so it's declared...

    $(".textAreaQuestion").each(function() {
        if (!this.value || this.value.length &lt; 5) {
            alertValidation += "\nYou have not entered a valid Question\n";
        }

            if(alertValidation != ""){ 
                return false;//Stop the each loop 
            } 
    });

        $(".numberAnswerTxtRow").each(function() {

        if (!this.value) {
            alertValidation += "\nPlease Enter in the Number of Answers you Require for this question\n";
        }

    if(alertValidation != ""){ 
                return false;//Stop the each loop 
            } 

    });

        $(".txtWeightRow").each(function() {
        if (!this.value) {
            alertValidation += "\nPlease enter in a figure for Number of Marks for this Question\n";
        }

            if(alertValidation != ""){ 
                return false;//Stop the each loop 
            } 
    });
</code></pre>

<p>What the code above does is that it displays an alert for each row if there are any errros in the row.</p>

<p>Example:</p>

<p>If in a table row the user has left .textAreaQuestion, .numberAnswerTxtRow and .textWeightRow all empty, then in the alert it will display all of the related messages in one alert like below:</p>

<pre><code>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
</code></pre>

<p>Now each table row has its own question number (table row number). So what I want to know is that how can I include the question number in the alert so that it states which rows the alert messages are refering to? If it was like the example above I want the alert to be displayed like below:</p>

<pre><code>You have errors on question number: 1 // how do I display this line in the alert

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
</code></pre>

<p>Below is the code on how the question number is added into each table row:</p>

<pre><code>var qnum = 1;

function insertQuestion(form) {  

    var $tbody = $('#qandatbl &gt; tbody'); 
    var $tr = $("&lt;tr class='optionAndAnswer' align='center'&gt;&lt;/tr&gt;");
    var $qid = $("&lt;td class='qid'&gt;" + qnum + "&lt;/td&gt;");

$tr.append($qid);
$tbody.append($tr); 

   $(form).find('.numberOfQuestions').val(qnum);

    ++qnum;
    $("#questionNum").text(qnum);

}
</code></pre>

<p>Thanks</p>
