<script type="text/javascript">
// Incremental variable to set unique ID attribute
var count = 0;
// Click handler
function onClick() {
// Incrementing the value upon every click
count++;
// Dynamically creating an input element
var inputEle = document.createElement('input');
// Setting ID attibute to the dynamic inputs
inputEle.setAttribute('id', 'dropdown' + count);
// Appending the created element to the DOM
document.getElementById('renderdropdown').appendChild(inputEle);
// Datasource for the DropDownList
var sportsData = ['Badminton', 'Cricket', 'Football', 'Golf', 'Tennis'];
// Rendering the DropDownList
var listObj = new ej.dropdowns.DropDownList({
dataSource: sportsData,
placeholder: "Select games"
});
listObj.appendTo(inputEle);
}
</script> |