Click here to Skip to main content
14,733,890 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
I Want to create and fill combobox dynamically on clicking on button.
For example I have values in database, like:-
id Name
1 A
2 B
3 C

Now, this should get fill in combobox.
Also, Every time I hit buttin, new combo should create.
SO, please help me....
Posted
Comments
   
Why it seems to be a problem? Just do it.
--SA
khushboo86 26-Sep-11 1:35am
   
How ??
Pravin Patil, Mumbai 26-Sep-11 1:33am
   
What do you mean by new combo should create...?
khushboo86 26-Sep-11 1:35am
   
I mean Every time I hit the button, I want new combobox.... Like If I hit button, first combo will create, then when I hit button again, second combo should create....
arya1685 18-Oct-11 6:12am
   
Previous combo should be displayed or removed......

if u want display first combo on first click
second on second click and so on.........

Just echo the combo tag on every click of button and set where u want to display..............
   
hi
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title> - jsFiddle demo</title>

  <script type='text/javascript' src='js/jquery.min.js'></script>

  <link rel="stylesheet" type="text/css" href="/css/normalize.css">
  <link rel="stylesheet" type="text/css" href="/css/result-light.css">

  <style type='text/css'>

  </style>



<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$("#addBtn").click(function() {
    $('#mycombobox').clone().appendTo('#myloc');
});
});//]]>

</script>


</head>
<body>
  <div id="myloc">
<select id="mycombobox">
<option>A</option>
<option>B</option>
</select>
</div>
<input type="button" id="addBtn" value="add cb">


</body>

</html>
   

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




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900