Note that there are some explanatory texts on larger screens.

plurals
  1. POIt is not displaying number in string
    primarykey
    data
    text
    <p>I am using this code below to state which table row (question number) the error is occurred in. </p> <pre><code> var _qid = $("td.qid", this).text(); var _msg = "You have errors on Question Number: " + _qid + "\n"; </code></pre> <p>The code above goes into the validation function below:</p> <pre><code> function validation() { var _qid = $("td.qid", this).text(); var _msg = "You have errors on Question Number: " + _qid + "\n"; 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() { 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 } }); </code></pre> <p>The problem is that it is not displaying the number. It is displaying this "You have errors on Question Number: " but it does not show the question number after the semi colon. How can I get the number to appear?</p> <p>Below is the code which adds each table row and adding the question number column in the added rows (table row 1 is question number 1, table row 2 is question number 2 and etc):</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>Below is the html the added rows are added into:</p> <pre><code>&lt;table id="qandatbl" align="center"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th class="qid"&gt;Question No&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt;&lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>The validation is checked by the myclickHander() function like this:</p> <pre><code>function myClickHandler(){ if(validation()){ showConfirm(); } } </code></pre> <p>The myClickHandler() function is called from a submit button like this: </p> <pre><code>&lt;p&gt;&lt;input id="submitBtn" name="submitDetails" type="submit" value="Submit Details" onClick="myClickHandler(); return false;" /&gt;&lt;/p&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload