大家好我使用复选框加载表单如果选中我想要加载表单别删除表单下面是我的代码
$('.checkbox-primary').change(function () {
$url = $('.form-edit').attr('action');
$form = $('.form-edit').serialize();
$.post($url, $form ,function ($data) {
var x=document.getElementById("filebox_edit_hardcopylocation_warehouse");
var warehouse=document.getElementById("filebox_edit_hardcopylocation_warehouse");
if(x){
$('.panel-footer').removeChild(warehouse);
alert("yes");
}
else
{
$('.form-edit').append('<div class="form-group"> <label class="col-md-3 col-xs-12 control-label">WareHouse: </label> <div class="col-md-6 col-xs-12"> <select id="filebox_edit_hardcopylocation_warehouse" name="filebox_edit[hardcopylocation][warehouse]" class="form-control"><option value="">Please Select Warehouse</option><option value="6">HQ4</option><option value="7">KTC</option></select> </div> </div> <select id="filebox_edit_hardcopylocation_floor" name="filebox_edit[hardcopylocation][floor]" class="form-control"><option value="">Please Select Floor</option><option value="1">first floor</option><option value="2">second floor</option><option value="3">second floor</option><option value="4">first floor</option></select><select id="filebox_edit_hardcopylocation_room" name="filebox_edit[hardcopylocation][room]" class="form-control"><option value="">Please Select Room</option><option value="9">R122</option><option value="10">R2</option></select><select id="filebox_edit_hardcopylocation_rack" name="filebox_edit[hardcopylocation][rack]" class="form-control"><option value="">Please Select Rack</option><option value="15">RA3456</option><option value="16">RA1</option><option value="17">RA2</option><option value="18">RA39</option></select>')
}
})
});
答案 0 :(得分:0)
使用JQuery,您可以检查:
controller