Install Theme

Your web-browser is very outdated, and as such, this website may not display properly. Please consider upgrading to a modern, faster and more secure browser. Click here to do so.

Hexa's Developments

Jan 21 '12

Adding textfield javascript

Javascript

function addRow()

  {

tabBody = document.getElementById(“inputtable”);

row = document.createElement(“TR”);

cell1 = document.createElement(“TD”);

textnode1=document.createElement(“input”);

textnode1.name=”episode[]”;

textnode1.type=”text”;

textnode1.placeholder=”Episode”;

cell1.appendChild(textnode1);

row = document.createElement(“TR”);

cell2 = document.createElement(“TD”);

textnode2=document.createElement(“input”);

textnode2.name=”link[]”;

textnode2.type=”text”;

textnode2.placeholder=”Link”;

cell2.appendChild(textnode2);

row = document.createElement(“TR”);

cell3 = document.createElement(“TD”);

textnode3=document.createElement(“input”);

textnode3.name=”description[]”;

textnode3.type=”text”;

textnode3.placeholder=”Description”;

cell3.appendChild(textnode3);

row.appendChild(cell1);

row.appendChild(cell2);

row.appendChild(cell3);

tabBody.appendChild(row);

}

HTML

  <table>

    <tbody id=”inputtable”>

      <tr>

 <td><input type=”text” name=”episode[]” placeholder=”Episode” /></td>

 <td><input type=”text” name=”link[]” placeholder=”Link” /></td>

 <td><input type=”text” name=”description[]” placeholder=”Description”/></td>

 </tr>

    </tbody>

  </table>

  <table>

    <tr>

    <td><input type=”button” value=”Add Row” onclick=”addRow();” /></td>

    <td><input type=”submit” class=”create” value=”Create” /></td>

    </tr>

 </table>

35 notes Tags: javascript html textfield inputbox

  1. hexadev posted this