By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,885 Members | 1,072 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,885 IT Pros & Developers. It's quick & easy.

How to create dynamic textbox in javascript

P: 2
Hi,How to create dynamic Texboxs in javascript and thereafter i need to get values from each textbox

Thanks in advance
Aug 14 '07 #1
Share this Question
Share on Google+
2 Replies


pbmods
Expert 5K+
P: 5,821
Heya, Naveen. Welcome to TSDN!

When you create the textbox, you can save the reference in a global variable, for example:
Expand|Select|Wrap|Line Numbers
  1. var textboxes = {};
  2.  
  3. .
  4. .
  5. .
  6.  
  7. textboxes['theIdOfTheTextBox'] = document.createElement('textbox');
  8.  
  9. .
  10. .
  11. .
  12.  
  13. textboxes['theIdOfTheTextBox'].value = 'the new value for the textarea';
  14.  
Aug 14 '07 #2

P: 2
Heya, Naveen. Welcome to TSDN!

When you create the textbox, you can save the reference in a global variable, for example:
Expand|Select|Wrap|Line Numbers
  1. var textboxes = {};
  2.  
  3. .
  4. .
  5. .
  6.  
  7. textboxes['theIdOfTheTextBox'] = document.createElement('textbox');
  8.  
  9. .
  10. .
  11. .
  12.  
  13. textboxes['theIdOfTheTextBox'].value = 'the new value for the textarea';
  14.  

Thanks,Hello Sir ,
i am using Div tag to create dynamic textbox
for ex:
Expand|Select|Wrap|Line Numbers
  1. function generateRow() {
  2.     var d=document.getElementById("div");
  3.     d.innerHTML+="<input type='text' name='txt1'>";
  4.     d.innerHTML+="<input type='text' name='txt2'><br>" ;
  5.     numLinesAdded++;    
  6.     } 
actually am not aware of this javascript functionality as i am new
could you please provide more information in this regard...
Aug 14 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.