3 Replies - 6479 Views - Last Post: 06 January 2014 - 11:15 PM

#1 hussainsha  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 27-December 13

Append or add dropdown list using input from from textbox

Posted 05 January 2014 - 11:05 PM

Hi,sorry i have entered some mistake in last topic so i have corrected posted again.
I want to add dropdown boxes depending on input value for example if i give number '10' in textbox and by using onclick function.I want to get 10 dropdown.I have tried for adding text boxes.Below code working fine for textboxes but i want to do the same for dropdown
<script type="text/javascript">
function getinput()
{
var j = document.getElementById('dept').value;
alert(escape(j));

var i=0;
for (i=0;i<j;i++)
{

var name="<br>Name : <input type='text' name='name'>";
var age=" Age : <input type='text' name='age'>";
$("#inputs").append(name,age);

/*
I want to add this.instead of textbox
<select name="graduation">
<option>Select Graduation</option>
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
</select>


*/
}
}
</script>

<div class="form_box" id="button" style="display:none;  float:right; width:5%; ">
<input type="button" id="button" onclick="getinput()" value="Click Here to add Group "> 
  </div>
<div class="form_right name">
<input name="dept" type="text" id="dept" value="" > 
</div>
<div class="field " id="inputs">
//here i will get textboxes

</div> 



Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Append or add dropdown list using input from from textbox

#2 macosxnerd101  Icon User is online

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12135
  • View blog
  • Posts: 45,119
  • Joined: 27-December 08

Re: Append or add dropdown list using input from from textbox

Posted 05 January 2014 - 11:07 PM

I will move this to Javascript. This is not a PHP question.

Also, in the future, please do not open duplicate threads. Just append a post or click the report button if you need something corrected.
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is offline

  • lashings of ginger beer
  • member icon

Reputation: 6340
  • View blog
  • Posts: 25,572
  • Joined: 12-December 12

Re: Append or add dropdown list using input from from textbox

Posted 06 January 2014 - 12:08 AM

What is the question? You have essentially all the code you need, give it a try.
Was This Post Helpful? 0
  • +
  • -

#4 hussainsha  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 27-December 13

Re: Append or add dropdown list using input from from textbox

Posted 06 January 2014 - 11:15 PM

My question is how to add number of dropdown list at a time depending on input value.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1