向div中动态添加删除节点

来源:互联网 发布:37传奇霸业龙脉数据 编辑:程序博客网 时间:2024/05/23 21:08
function appendA(){var fileType_ = $("[name='file']").val();var childrenlength = $('#hiddenfile').children().length;$("#hiddenfile").append("<div style=\"padding:5px;padding-left:10px\"><a id='file1a"+childrenlength+"' href=\"#\">"+fileType_+"</a>"+"<input id='file1"+childrenlength+"' type=hidden name='file1' value='"+fileType_+"'/>"+"<a style=\"margin-left:20px;\" onclick=\"deleteFile('#file1a"+childrenlength+"')\" href=\"#\" >删除</a>"+"</br></div>");$("#file1a"+childrenlength).html($("#file").val());$("#file").replaceWith("<input type=\"file\" id=\"file\" name=\"file\">");}