Add More Check Box

In the Add More Check Box script is use to create one or more a check box dynamically through DOM.

Demo :



Check : 

Example :

You click a Add More Button and see more check box at broswer.

Code :

Following code is Add More Check Box script code if you need to copy and use to your web site.


<script type="text/javascript">
var checkCount = 0;
function addcheck (parentEl)
{
  if (!parentEl)
  {
    return false;
  }
  parentEl = document.getElementById(parentEl);
  if (parentEl == null)
  {
    return false;
  }
  var newcheck = document.createElement("input");
  newcheck.type = "checkbox";
  newcheck.id = "mycheck"&++checkCount;
  newcheck.name = "mycheck";
  newcheck.value = "123123";
  newcheck.className='check_box';
  parentEl.appendChild(newcheck);
  return false;
}
</script>
<fieldset id="somechecks" class="checkset">
   <legend><input type="checkbox" ></legend>
</fieldset>
  <input type="button" value="Add More" onclick="return addcheck('somechecks');" >

In the above addcheck() function is use to create more a check box.That functions have one arguments that is parentEl.document.createElement("input") is generate a input check box and checkCount variable is use to create to child check box id.appendChild() function is use to replace dom object into original check box.

Free Download Script:

If you need to Add More Check Box Script click and download from following zip file.

Download




Content