alert not working the way I want it to work
<p>In this <a href="http://jsfiddle.net/euL5e/" rel="nofollow">jsfiddle</a>, please follow the steps below:</p>

<p>1: When you open fiddle click on the "Add Question" button twice, this will add 2 rows underneath.</p>

<p>2: Click on the "Submit details" button and it will come up with this error:</p>

<blockquote>
  <p>You have errors on Question Number: 2</p>
  
  <p>You have not entered a valid Question</p>
  
  <p>Please Enter in the Number of Answers you Require for this question</p>
  
  <p>Please enter in a figure for Number of Marks for this Question</p>
  
  <p>You have not entered a valid Question</p>
  
  <p>Please Enter in the Number of Answers you Require for this question</p>
  
  <p>Please enter in a figure for Number of Marks for this Question</p>
</blockquote>

<p>This is incorrect, the alert above displays all of the errors and the incorrect question number. What should happen is that if there are errors in multiple rows, then it should display the number of the first row which contains errors and display those errors in the alert. The alert should display this:</p>

<blockquote>
  <p>You have errors on Question Number: 1</p>
  
  <p>You have not entered a valid Question</p>
  
  <p>Please Enter in the Number of Answers you Require for this question</p>
  
  <p>Please enter in a figure for Number of Marks for this Question</p>
</blockquote>

<p>Also another problem is that if in the second row you fill in the textarea and textboxes, it displays this alert below:</p>

<blockquote>
  <p>You have errors on Question Number: 2</p>
  
  <p>You have not entered a valid Question</p>
  
  <p>Please Enter in the Number of Answers you Require for this question</p>
  
  <p>Please enter in a figure for Number of Marks for this Question</p>
</blockquote>

<p>The above alert is incorrect as it is stating the wrong question number where the errors are. The question number should be number 1, not number 2. So how can this be fixed as well.</p>

<p>Below is the code of the validation() function where the alerts are controlled:</p>

<pre><code>function validation() {

    var _qid = "";
    var _msg = "";

    alertValidation = "";
    // Note, this is just so it's declared...
    $("tr.optionAndAnswer").each(function() {


        _qid = $("td.qid",this).text();
        _msg = "You have errors on Question Number: " + _qid + "\n";

        $(".textAreaQuestion",this).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",this).each(function() {


            var currenttotal = $(this).closest('.optionAndAnswer').find('.answerBtnsOn').length;

            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",this).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 
            }
        });
    });

    if (alertValidation != "") {
        alert(_msg + alertValidation);
        return false;
    }

    return true;
}
</code></pre>
