i need same table again when clicking ADD Button...but here when i insert some value in first table and click add button, generate th value inserted table again...i need empty table(all time.ie,after putting value in 1sttable also)
And how to insert all these tables data to database
<script language="javascript" type="text/javascript">
function Add(id){
var table=document.getElementById(id);
var clone=table.getElementsByTagName('TBODY')[0].cloneNode(true);
table.appendChild(clone);
counter++;
}
</script>
<table border="0" id="tst">
<tr>
<td>Facility Name
<label>
<input type="text" name="o_f" id="o_f" size="27"/>
</label></td>
</tr>
<tr>
<td>Address<label>
<textarea name="o_add" id="o_add" cols="23" style="margin-left:36px; margin-top:0px;"></textarea>
</label></td>
</tr>
<tr>
<td>City <label>
<input type="text" name="o_city" id="o_city" size="27" style="margin-left:63px;margin-top:-16px;"/>
</label></td>
</tr>
</table>
<input type="submit" name="button" id="button" value="ADD"><input type="button" value="Add" onclick="Add('tst');"/>
Add dynamic table on button click
Moderator: General Moderators
-
snehathomas184
- Forum Newbie
- Posts: 7
- Joined: Tue May 27, 2014 3:40 am
Add dynamic table on button click
Last edited by snehathomas184 on Tue May 27, 2014 9:22 am, edited 2 times in total.
Re: Add dynamic table on button click
You've got a mess of unmatched nested tables there. You'll probably want to clean that up before doing anything else. That said, something like this? http://jsfiddle.net/Awc7S/