title: all text inputs are blank when validating
body: <p>My question is that how can I get the validation message to appear if there is any blank text input per question?</p>
  
  <p>Here is a fiddle so you can test it: <a href="http://jsfiddle.net/cbyJD/87/" rel="nofollow">http://jsfiddle.net/cbyJD/87/</a></p>
  
  <p>Below is the validation() function code:</p>
  
  <pre><code>function validation() {
  
      // only keeping track of the final message
      var alertValidation = "",
          // toggle for showing only one error
          showOnlyOneError = true;
  
      $("input[data-type='qmark']").each(function(i) {  
          var questions = $(this).attr("data-qnum");
          var marks = parseInt($("[class*=q" + (i+1) + "_ans_text]").text()); 
          var txtinput = $(this).val(); 
  
          // the message for this question
          var msg = '';
  
          if (txtinput == '') {
              msg += "\n\u2022 You have not entered in a value in all the Indivdiaul Marks textbox \n";
          }
  
          if (marks &lt; 0) {
              msg += "\n\u2022 Your Total Marks Remaining does not equal 0 \n - You Need To Remove " + Math.abs(marks) +  " Marks";   
          } else if (marks &gt; 0) {
              msg += "\n\u2022 Your Total Marks Remaining does not equal 0 \n - You Have " + marks +  " Marks Remaining";   
          }
  
          // if there is an error for the question, add it to the main message
          if (msg.length) {
              alertValidation += alertValidation.length ? '\n\n' : '';
              alertValidation += "You have errors on Question Number: " + questions + "\n";
              alertValidation += msg;
              // stop if we only care about the first error
              return !showOnlyOneError;
          }
      });
  
      // show the error messages
      if (alertValidation != "") {
          alert(alertValidation);
          return false;
      }
  
      return true;
  }
  </code></pre>