Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get new table rows onClick only when one line of previous inputs is not empty?
    primarykey
    data
    text
    <p>How to get new rows onClick only when <strong>one line of previous</strong> inputs is not empty?</p> <p>*<em>"one line of previous inputs" - I have 1 row of blank inputs, as soon as I click on it, next row will be created, but I that 1st row is going to be empty or partialy full, than I dont want to create a new row.</em></p> <p>The following code is what I have so far which is:<br> - first row created onLoad<br> - when clickin on input new row is created<br> - checkempty funcion is ready to use</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;GE Watch&lt;/title&gt; &lt;style type="text/css"&gt; input{width:76px;height:20px;padding:0;margin:0;display:block;float:left}table{padding:0;margin:0;border:thin dotted #333}tr{padding:0;margin:0}td{width:80px;height:20px;padding:0;margin:0;text-align:center} &lt;/style&gt; &lt;script language="javascript" type="text/javascript"&gt; function addRow(id){ var tbody = document.getElementById (id).getElementsByTagName("tbody")[0]; var row = document.createElement("tr") var RowCount = 11; for (i = 1; i &lt;= RowCount; ++i) { var td = document.createElement("td") td.appendChild(document.createElement("input")) td.id = "td" + i; td.setAttribute("onclick", "javascript:addRow('myTable');") row.appendChild(td); } tbody.appendChild(row); } function checkempty() { checking = document.getElementById(cellId); if (checking.value == "" || " " || null) { return false; } else { return true; } } &lt;/script&gt; &lt;/head&gt; &lt;body onLoad = "javascript:addRow('myTable')"&gt; &lt;a href="javascript:addRow('myTable')"&gt;Add row&lt;/a&gt; &lt;table id="myTable"&gt; &lt;tr&gt; &lt;td&gt;#&lt;/td&gt; &lt;td&gt;CHECK&lt;/td&gt; &lt;td&gt;DATE&lt;/td&gt; &lt;td&gt;HOUR&lt;/td&gt; &lt;td&gt;MIN&lt;/td&gt; &lt;td&gt;MARKET&lt;/td&gt; &lt;td&gt;MAX&lt;/td&gt; &lt;td&gt;BUY&lt;/td&gt; &lt;td&gt;SELL&lt;/td&gt; &lt;td&gt;PROFIT&lt;/td&gt; &lt;td&gt;FLIP TIME&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    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.
 

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