Home  >  Article  >  Web Front-end  >  jquery append tr and delete tr sample code_jquery

jquery append tr and delete tr sample code_jquery

WBOY
WBOYOriginal
2016-05-16 17:22:441073browse
复制代码 代码如下:


<script> <br>$(function(){ <br>$("#getAtr").click(function(){ <br>$str=''; <br>$str ="<tr align='center'>"; <br>$str ="<td><input type='text' name='advTitle[]'/></td>"; <br>$str ="<td><input type='file' name='img[]' /></td>"; <br>$str ="<td><input type='text' name='advContent[]' /></td>"; <br>$str ="<td><input type='text' name='advSource[]' /></td>"; <br>$str ="<td><input type='text' name='advAuthor[]' /></td>"; <br>$str ="<td><input type='text' name='advPosition[]' /></td>"; <br>$str ="<td onClick='getDel(this)'><a href='#'>删除追加</a></td>"; <br>$str ="</tr>"; <br>$("#addTr").append($str); <br>}); <br>}); <br><br>function getDel(k){ <br>$(k).parent().remove(); <br>} <br></script>

--------------------------------------------------------------------------------
html部分
























广告名称 广告图片 广告内容 广告来源 广告作者 广告描述 追加内容

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn