Bookmark Topic Watch Topic
  • New Topic

Add text fields on click of a button

 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi Ranchers,
I want to add text fields onclick of a button. I have tried the below code for it. It doesn't work

Also instead of <input type='text'> i want to put in my struts tag <html:text>. Is it possible?

If no, then can you all please suggest me any other implementation technique.



function generateRow() {

var d=document.getElementByProperty("add");
d.innerHTML+="<input type='text' name='field1'>";
d.innerHTML+="<input type='text' name='field2'>" ;

}


<tr>
<<td >
<html:button property="add" value="Add Row" onclick="generateRow();"></html:button>
</td>
</tr>

Thanks




 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi Deeps, Please Carefully Choose One Forum
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Report post to moderator
seetharaman venkatasamy wrote:Hi Deeps, Please Carefully Choose One Forum

Hey seetahraman... since m new to this forum..n in a hurry to finish off a task assigned to me by my seniors..i jus overlooked where i am posting the query.

Thanks for your kind help.

 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Report post to moderator
If you want to use struts specific tag, then its better to have it there in a div or span perhaps, but its not necessary. And then make it hidden in the start, onClick you can make it visible. This is by using style.

And by the way, its better to move this question to HTML/JavaScript Forum, I guess.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Deeps Mistry wrote:i jus overlooked where i am posting the query.

Regardless of your hurry, please take the time to choose the correct forum for your posts. This forum is for questions on JSP. For more information, please read this.

Please post this question in the JavaScript forum, and be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!