Saturday, 24 August 2013

jquery clone an html structure with out text content

jquery clone an html structure with out text content

every one. please help me.
how to clone an html structure ( with tables and input field ) without its
input content.
this is my html code
<div class="clone_wrapp">
<div class="clone_table">
<div class="two_column_table">
<table>
<tr><td>Name of officer-in-charge</td></tr>
<tr><td><input type="text"></td></tr>
<tr><td>Contact No</td></tr>
<tr><td><input type="text"></td></tr>
</table>
</div> <!-- two_column_table -->
<div class="two_column_table">
<table>
<tr>
<td>Address</td>
<td><textarea></textarea></td>
</tr>
</table>
</div> <!-- two_column_table -->
</div> <!-- clone_table -->
</div> <!-- cloned wrapp -->
<div class="add_more_field">ADD MORE</div>
and this is my jquery
$('.add_more_field').click(function(){
var cloned_structure= $('.clone_table').clone();
$('.clone_wrapp').append(cloned_structure);
});
the code is working but it will append along with input content
thanks

No comments:

Post a Comment