DEV Community

ankit3131
ankit3131

Posted on

How can add checkbox in input from enter?

Image description`

</head>
<body>
Enter fullscreen mode Exit fullscreen mode

Image description
Search:

Click the button to display the value of the value attribute of the search field.















<br>
function myFunction()<br>
{<br>
if(event.keyCode === 13){<br>
debugger;<br>
var table = document.getElementById(&quot;table&quot;);<br>
var row = table.insertRow(-1);<br>
var date = row.insertCell(0);<br>
table.appendChild(row); <br>
date.innerHTML = document.getElementById(&quot;mySearch&quot;).value;</p>
<div class="highlight"><pre class="highlight plaintext"><code>//insert checkbox//
function editTd()
{
var rows = document.getElementById('table').rows;
for (var i = 0; i &lt; rows.length; i++) {
var row = rows[i];
for(var j =0; j&lt;row.cells.length; j++){
var inputs = document.createElement("input");
inputs.type = "checkbox";
rows.cells[j].appendChild(inputs);
};
};
};

editTd();
</code></pre></div>
<p>}</p>

<p>}<br>




`

Top comments (0)