How to Add Dynamic Control with help of jQuery

Dynamic html control is very common functionality in web, normally we are using add dynamic row in table based on our application requirement. This tutorial will help you to add dynamic control with help of query.

Checkout other tutorial of Dynamically Add/edit and Delete Using jQuery,

Dynamically Add Remove Rows in Table Using jQuery

[code trype=javascript]
that.addControl = function(type) {
controlType = type == ‘image’ ? ‘input’ : ‘textarea’;
var element = document.createElement(controlType);
element.setAttribute(“name”, ‘data’);
element.setAttribute(“id”, ‘data’);
if(type == ‘image’) {
element.setAttribute(“type”, ‘text’);
element.setAttribute(“class”, ‘xlarge’);
} else {
element.setAttribute(“class”, ‘xxlarge’);
element.setAttribute(“rows”, ‘9’);
element.setAttribute(“cols”, ’45’);