Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#4.0 jQuery ASP:NET
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 at 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
0 OriginalGriff 7,205
1 DamithSL 5,114
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,747
4 Kornfeld Eliyahu Peter 4,474

Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 12 Sep 2012
Copyright © CodeProject, 1999-2014
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