Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to disable textarea and hyperlink
    primarykey
    data
    text
    <p>I have a table where the user can add rows to it but each row is numbered. Now the user enters a number in a textbox for the number of rows he/she wants to add before they actually start adding rows. Below is the code where if the number of rows that has been added is over the number entered by the user, then it stops adding the rows.</p> <pre><code> if (qnum &gt; &lt;?php echo (int)@$_POST['textQuestion']; ?&gt;) { return; } </code></pre> <p>Example: if user entered in the number 5 in a textbox, then the user can only add 5 rows, if the user tries to add another row, then no row is added because user can't add more than 5 rows.</p> <p>What my question is that if the user has already reach the max number of rows they have added, then I want it to disable a textarea (user wont be able to click in the textarea and I want to give it the correct colour so that you can tell the textarea is disabled). I also want to disable a hyperlink so that user cannot click on the hyperlink (again suitable color change so user can tell hyperlink is disabled) Does anyone know how to do this?</p> <p>Below is code for hyperling and the textarea:</p> <pre><code> &lt;table id="question"&gt; &lt;tr&gt; &lt;th colspan="2"&gt; Question Number &lt;span id="questionNum"&gt;1&lt;/span&gt; &lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td rowspan="3"&gt;Question:&lt;/td&gt; &lt;td rowspan="3"&gt; &lt;textarea id="questionTextArea" rows="5" cols="40" name="questionText"&gt;&lt;/textarea&gt; &lt;span href="#" class="link"&gt;[Question link]&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Jquery code showing example of how a table row is added:</p> <pre><code>function insertQuestion(form) { var questionarea=(form.questionText.length) ? form.questionText[0] : form.questionText; var context = $('#optionAndAnswer'); var currenttotal = context.find('.answerBtnsOn').length; alertErrors = ""; // Note, this is just so it's declared... if (questionarea.value == ""){ if (qnum &gt; &lt;?php echo (int)@$_POST['textQuestion']; ?&gt;) { return; } 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); } </code></pre> <p>Html table where the table row is added to:</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>look at this jsfiddle for example <a href="http://jsfiddle.net/DQUKN/42/" rel="nofollow">here</a>, you can write a question on top using the textarea and when you have done that then click on the button to add it in a new row. It is the top textarea I want to disable only if the number of rows has met its limit.</p>
    singulars
    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