YoucreateaWebpagethatcontainsthefollowingcode.Youneedtoprovidethefollowingimplementation.EachtimetheAddFilebuttonisclicked,anewdivelementiscreated.ThenewdivelementisappendedaftertheotherfileuploaddivelementsandbeforetheAddFilespan.Eachnewelementhasaunique

题目

YoucreateaWebpagethatcontainsthefollowingcode.Youneedtoprovidethefollowingimplementation.EachtimetheAddFilebuttonisclicked,anewdivelementiscreated.ThenewdivelementisappendedaftertheotherfileuploaddivelementsandbeforetheAddFilespan.Eachnewelementhasauniqueidentifier.Whichcodesegmentshouldyouuse?()

A.$("#AddFile").click(function(){varid="File"+++lastId;varitem=$(".File:first").clone(true);$("input:file",item).attr({id:id,name:id});item.insertBefore("#AddFile");});

B.$("#AddFile").click(function(){varid="File"+++lastId;$(".File:first").clone(true).attr({id:id,name:id}).insertBefore("#AddFile");});

C.$("#AddFile").click(function(){varid="File"+++lastId;});

D.$("#AddFile").click(function(){varid="File"+++lastId;varitem=$(".File:first").clone(true);$("input:file",item).attr({id:id,name:id});item.insertAfter("input[type=file]");});


相似考题