You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.5 KiB
45 lines
1.5 KiB
(function ($) {
|
|
$.fn.labelauty = function (tag, tag2) {
|
|
|
|
//判断是否选中
|
|
rdochecked(tag);
|
|
|
|
//单选or多选
|
|
if (tag2 == "rdo") {
|
|
//单选
|
|
$(".rdobox").click(function () {
|
|
$(this).prev().prop("checked", "checked");
|
|
rdochecked(tag);
|
|
});
|
|
} else {
|
|
//多选
|
|
$(".chkbox").click(function () {
|
|
//
|
|
if ($(this).prev().prop("checked") == true) {
|
|
$(this).prev().removeAttr("checked");
|
|
}
|
|
else {
|
|
$(this).prev().prop("checked", "checked");
|
|
}
|
|
rdochecked(tag);
|
|
});
|
|
}
|
|
|
|
//判断是否选中
|
|
function rdochecked(tag) {
|
|
$('.' + tag).each(function (i) {
|
|
var rdobox = $('.' + tag).eq(i).next();
|
|
if ($('.' + tag).eq(i).prop("checked") == false) {
|
|
rdobox.removeClass("checked");
|
|
rdobox.addClass("unchecked");
|
|
rdobox.find(".check-image").css("background-image", "url(admin/images/icon/input-unchecked.png)");
|
|
}
|
|
else {
|
|
rdobox.removeClass("unchecked");
|
|
rdobox.addClass("checked");
|
|
rdobox.find(".check-image").css("background-image", "url(admin/images/icon/input-checked.png)");
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}(jQuery)); |