Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A complete working example - <a href="http://jsfiddle.net/QmHdL/" rel="noreferrer">http://jsfiddle.net/QmHdL/</a></p> <p>Table can be created like this</p> <pre><code>&lt;table id="myTable"&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" name="links"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="keywords"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="violationtype"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="button" class="button" value="Add another line" onclick="addField();"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Now, <code>addField</code> has to be implemented like this</p> <pre><code> function addField (argument) { var myTable = document.getElementById("myTable"); var currentIndex = myTable.rows.length; var currentRow = myTable.insertRow(-1); var linksBox = document.createElement("input"); linksBox.setAttribute("name", "links" + currentIndex); var keywordsBox = document.createElement("input"); keywordsBox.setAttribute("name", "keywords" + currentIndex); var violationsBox = document.createElement("input"); violationsBox.setAttribute("name", "violationtype" + currentIndex); var addRowBox = document.createElement("input"); addRowBox.setAttribute("type", "button"); addRowBox.setAttribute("value", "Add another line"); addRowBox.setAttribute("onclick", "addField();"); addRowBox.setAttribute("class", "button"); var currentCell = currentRow.insertCell(-1); currentCell.appendChild(linksBox); currentCell = currentRow.insertCell(-1); currentCell.appendChild(keywordsBox); currentCell = currentRow.insertCell(-1); currentCell.appendChild(violationsBox); currentCell = currentRow.insertCell(-1); currentCell.appendChild(addRowBox); } </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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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