jQuery动态添加 input type=file的实现代码
摘要:复制代码代码如下:核心jquery代码复制代码代码如下://添加一行functionadd(){varcontent="";content+...
复制代码 代码如下:
<form id="fileForm" action="" method="post" enctype="multipart/form-data">
<tr>
<td>
<input type="file" name="file"><input type="button" id="addButon" value="Add">
</td>
</tr>
</form>
核心jquery代码
复制代码 代码如下:
//添加一行<tr>
function add() {
var content = "<tr><td>";
content += "<input type='file' name='file'><input type='button' value='Remove' onclick='remove(this)'>";
content += "</td></tr>"
$("#fileForm").append(content);
}
//删除当前行<tr>
function remove(obj) {
$(obj).parent().parent().remove();
}
查字典教程网整理的在线演示:http://demo.jb51.net/jquery/juqery_input/
【jQuery动态添加 input type=file的实现代码】相关文章:
★ jQuery Timelinr实现垂直水平时间轴插件(附源码下载)
下一篇:
jQuery操作select的实例代码