我有这个功能:
CODE JS:
$('#add_new_rec').click(function (e) {
// custom handling here
e.preventDefault();
$('#input_sending_div').append('<div id="container-rec"><div class="row"><div class=" col-md-12"><label for="clg_firstname">First Name</label><input type="text" name="clg[\'fistname\'][]" id="clg_firstname[]"></div></div><div class="row"><div class=" col-md-12"><label for="clg_middlename">Middle Initial</label><input type="text" name="clg[\'middlename\'][]" id="clg_middlename[]"></div></div><div class="row"><div class=" col-md-12"><label for="clg_lastname">Last Name</label><input type="text" name="clg[\'lastname\'][]" id="clg_lastname"></div> </div><div class="row"><div class=" col-md-12"><label for="clg_phone">Phone Number</label><input type="text" name="clg[\'phone\'][]" id="clg_phone"></div></div><div clas="row"><div class=" col-md-12" id="last-input"><label for="clg_email">Email</label><input type="text" name="clg[\'email\'][]" id="clg_email"></div></div></div>');
});
代码HTML:
<p id="add_new_rec" >
<i class="fa fa-plus-square-o" ></i>
<span>Add new recipient</span>
</p>
我想知道jQuery中这个动作的反面是哪一个? 使用它删除功能吗?
提前致谢!
答案 0 :(得分:1)
有多种方法与之相反:
.empty()
:
$('#input_sending_div').empty(); // to clear the contents
.html()
:
$('#input_sending_div').html(''); // to clear the contents
答案 1 :(得分:0)
您可以remove()
使用$("#input_sending_div").remove("#container-rec");
。
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) throws Exception{
SpringApplication.run(Application.class, args);
}
@Autowired
WorkflowListRepository wflListRepo;
@Bean(name="getAllCodeValue")
public List<WorkFlowList> allcodeValues(){
List<WorkFlowList> wflList= wflListRepo.getAllDocuments();
wflList= wflListRepo.getAllDocuments();
return wflList;
}
答案 2 :(得分:0)
是的,你可以在jQuery中使用remove api
$('#container-rec').remove();