Click here to Skip to main content
13,344,765 members (50,998 online)
Rate this:
Please Sign up or sign in to vote.
i want to add dynamic controls let us say(one dropdown ,two text boxes )
for that i have a button when user click on button a new row added
with these three controls

how to do this using jquery?
Posted 11-Sep-12 19:12pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

<div style="display:inline">
<input type="button" id="txtPlain" value="Add Plain Text" style="" />
<input type="button" id="txt" value="Add TextBox" style="" />
<input type="button" id="chk" value="Add CheckBox" style="" />
<input type="button" id="rad" value="Add Radio" style="" />
<input type="button" id="btn" value="Add Button" style="" />
<div id="holder">

and your JQUERY , you can change as per your requirement

var $ctrl = $('<input/>').attr({ type: 'text', name:'text', value:'text'}).addClass("text");
var $ctrl = $('<input/>').attr({ type: 'checkbox', name:'chk'}).addClass("chk");
var $ctrl = $('<input/>').attr({ type: 'radio', name:'rad'}).addClass("rad");
var $ctrl = $('<input/>').attr({ type: 'button', name:'btn',value:'Button'}).addClass("btn");
var lbl = prompt ("Enter Text","");

if its working , give a special thank to Brij[^]
sharmarun 12-Sep-12 0:50am
i have to add dropdown and bind it with database

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.180111.1 | Last Updated 12 Sep 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100