Note that there are some explanatory texts on larger screens.

plurals
  1. POTwo Tables Add New Row Button - Conflicting
    primarykey
    data
    text
    <p>I have two tables, each with different ID's. I have a button below each table that adds a row (or so I want it to happen). When I just have the one button to click it works but when I introduce another, the buttons on both tables no longer work so I'm guessing there is a conflict between the two. Here are the tables:</p> <p>Table 1</p> <pre><code>&lt;table id='addTable' class='tableclass' width='655' border='1'&gt; &lt;tr&gt; &lt;td&gt;Column 1&lt;/td&gt;&lt;td&gt;Column 2&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;button type='button' onclick='displayResult()'&gt;Add New Row&lt;/button&gt; </code></pre> <p>Table 2 </p> <pre><code>&lt;table id='editTable' class='tableclass' width='655' border='1'&gt; &lt;tr&gt; &lt;td&gt;Column 1&lt;/td&gt;&lt;td&gt;Column 2&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;button type='button' onclick='displayResultEdit()'&gt;Add New Row&lt;/button&gt; </code></pre> <p>The javascript:</p> <pre><code>function displayResult() { var table=document.getElementById("addTable"); var row=table.insertRow(2); var cell1=row.insertCell(0); var cell2=row.insertCell(1); cell1.innerHTML="Additional row to column one on the Add table"; cell2.innerHTML="Additional row to column two on the Add table"; } function displayResultEdit() { var table=document.getElementById("editTable"); var row=table.insertRow(2); var cell1=row.insertCell(0); var cell2=row.insertCell(1); cell1.innerHTML="Additional row to column one on the Edit table"; cell2.innerHTML="Additional row to column two on the Edit table"; } </code></pre> <p>This is saved in a .js file and called upon below the tables. As I said, the table row gets added if only one table is present (and the top set of javascript) but when I introduce another, when you click the button nothing happens.</p> <p>Hope you can help..</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.
    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