|
@@ -920,7 +920,7 @@ function checkbox()
|
|
|
var checkbox = $("." + name);
|
|
|
if(checkbox.length)
|
|
|
{
|
|
|
- checkbox.click(function()
|
|
|
+ checkbox.unbind('click').bind('click', function()
|
|
|
{
|
|
|
var self = $(this);
|
|
|
|
|
@@ -932,7 +932,7 @@ function checkbox()
|
|
|
|
|
|
if($(this).get(0).checked == true)
|
|
|
{
|
|
|
- if(next.length && next.attr('type') != 'checkbox')
|
|
|
+ if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
|
|
|
{
|
|
|
next.attr('disabled', false);
|
|
|
}
|
|
@@ -943,7 +943,7 @@ function checkbox()
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(next.length && next.attr('type') != 'checkbox')
|
|
|
+ if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
|
|
|
{
|
|
|
next.attr('disabled', true);
|
|
|
}
|
|
@@ -966,7 +966,7 @@ function checkbox()
|
|
|
var len = $("." + name + "-" + self.val()).length;
|
|
|
$("." + name + "-" + self.val()).each(function()
|
|
|
{
|
|
|
- $(this).click(function()
|
|
|
+ $(this).unbind('click').bind('click', function()
|
|
|
{
|
|
|
var next = $(this).next();
|
|
|
|
|
@@ -986,36 +986,46 @@ function checkbox()
|
|
|
$("#mul_type").val(1);
|
|
|
}
|
|
|
|
|
|
- if(next.length && next.attr('type') != 'checkbox')
|
|
|
+ if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
|
|
|
{
|
|
|
next.attr('disabled', false);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //子选项取消时,处理一下父级选项
|
|
|
- var num = 0;
|
|
|
- $("." + name + "-" + self.val()).each(function()
|
|
|
+ if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
|
|
|
{
|
|
|
- if($(this).get(0).checked == true)
|
|
|
- {
|
|
|
- num = 1;
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- if(num == 0)
|
|
|
+ next.attr('disabled', true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var num = 0;
|
|
|
+ $("." + name + "-" + self.val()).each(function()
|
|
|
+ {
|
|
|
+ if($(this).get(0).checked == true)
|
|
|
{
|
|
|
- self.get(0).checked = false;
|
|
|
-
|
|
|
- if($("#mul_type").length)
|
|
|
- {
|
|
|
- $("#mul_type").val(0);
|
|
|
- }
|
|
|
+ num = 1;
|
|
|
}
|
|
|
+ });
|
|
|
+
|
|
|
+ var id = $(this).attr('name');
|
|
|
+ var hidden = id;
|
|
|
+ id = id.replace('[]', '');
|
|
|
+ if(num == 0)
|
|
|
+ {
|
|
|
+ self.get(0).checked = false;
|
|
|
|
|
|
- if(next.length && next.attr('type') != 'checkbox')
|
|
|
+ if($("#mul_type").length)
|
|
|
{
|
|
|
- next.attr('disabled', true);
|
|
|
+ $("#mul_type").val(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$('#' + id).length) {
|
|
|
+ self.parent().append('<input type="hidden" value="0" id="'+id+'" name="'+hidden+'" />');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ($('#' + id).length) {
|
|
|
+ $('#' + id).remove();
|
|
|
}
|
|
|
}
|
|
|
})
|