How to create a dynamic div using Javascript

| By Webner

Here is sample code if you want to create a dynamic div using Javascript:

<script type="text/javascript">
divCount =0;
function createDiv()
var divTag  = document.createElement("div");
var studList ="";
studList += '<select id="BOX_'+divCount+'" name="BOX_'+divCount+'">';
studList += '<option value="">--- Select ---</option>';
studList += '<option value="'+stud[i].stud_id+'">'+stud[i].stud_name+'</option>';
studList += '</select>';
divTag.innerHTML  = studList;

Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need Web development or any other software development assistance please contact us at

Leave a Reply

Your email address will not be published. Required fields are marked *