Add More Radio Button

In the Add More Radio Button script is use to create one or more a Radio box dynamically through DOM.

Demo :



Radio : 

Example :

You click a Add More Button and see more radio button at broswer.

Code :

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


<script type="text/javascript">
var radioCount = 0;
function addradio (parentEl)
{
  if (!parentEl)
  {
    return false;
  }
  parentEl = document.getElementById(parentEl);
  if (parentEl == null)
  {
    return false;
  }
  var newradio = document.createElement("input");
  newradio.type = "radio";
  newradio.id = "myradio"&++radioCount;
  newradio.name = "myradio";
  newradio.value = "123123";
  newradio.className='radio_box';
  parentEl.appendChild(newradio);
  return false;
}
</script>
<fieldset id="someradios" class="radioset">
   <legend><input type="radio" ></legend>
</fieldset>
  <input type="button" value="Add More" onclick="return addradio('someradios');" >

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

Free Download Script:

If you need to Add More Radio Button Script click and download from following zip file.

Download




Content