Step 1 : In Jsp, use id's and class's and use in under js file
class name = processID
url : action URL
data : Parameters
Step 2: js file written as,
$(document).ready(
function () {
$(".processID").live("click", function () {
processID = $('input[name="filterProcess"]:checked').attr('id');
$.ajax({
url: "performProcess",
data: "processId=" + processID,
cache: false,
success: function (data) {
document.getElementById("category").innerHTML = data;
$("#c1").html(down);
$("#c2").html(down);
$("#c3").html(down);
$("#c1Sub").hide();
$("#c2Sub").hide();
$("#c3Sub").hide();
}
});
});
$("#categoryCheck1").live("click", function () {
if ($(this).attr('checked')) {
$(".c1Set").attr('checked', true);
} else {
$(".c1Set").attr('checked', false);
}
});
$("#categoryCheck2").live("click", function () {
if ($(this).attr('checked')) {
$(".c2Set").attr('checked', true);
} else {
$(".c2Set").attr('checked', false);
}
});
$("#categoryCheck3").live("click", function () {
if ($(this).attr('checked')) {
$(".c3Set").attr('checked', true);
} else {
$(".c3Set").attr('checked', false);
}
});
/** *******************END*************************** */
$("input").live("click", function () {
var c1Count = $("#hiddenC1").val();
var c2Count = $("#hiddenC2").val();
var c3Count = $("#hiddenC3").val();
var value = 0;
value = $('input[name="c1"]:checked').length;
if (value == c1Count) {
$("#categoryCheck1").attr('checked', true);
} else {
$("#categoryCheck1").attr('checked', false);
}
value = $('input[name="c2"]:checked').length;
if (value == c2Count) {
$("#categoryCheck2").attr('checked', true);
} else {
$("#categoryCheck2").attr('checked', false);
}
value = $('input[name="c3"]:checked').length;
if (value == c3Count) {
$("#categoryCheck3").attr('checked', true);
} else {
$("#categoryCheck3").attr('checked', false);
}
value = $(".c1Set:checked").length + $(".c2Set:checked").length + $(".c3Set:checked").length;
if (value != 0) {
$("#completenessCheck").attr("disabled", true);
} else if (value == 0) {
$("#completenessCheck").attr("disabled", false);
}
});
class name = processID
url : action URL
data : Parameters
Step 2: js file written as,
$(document).ready(
function () {
$(".processID").live("click", function () {
processID = $('input[name="filterProcess"]:checked').attr('id');
$.ajax({
url: "performProcess",
data: "processId=" + processID,
cache: false,
success: function (data) {
document.getElementById("category").innerHTML = data;
$("#c1").html(down);
$("#c2").html(down);
$("#c3").html(down);
$("#c1Sub").hide();
$("#c2Sub").hide();
$("#c3Sub").hide();
}
});
});
$("#categoryCheck1").live("click", function () {
if ($(this).attr('checked')) {
$(".c1Set").attr('checked', true);
} else {
$(".c1Set").attr('checked', false);
}
});
$("#categoryCheck2").live("click", function () {
if ($(this).attr('checked')) {
$(".c2Set").attr('checked', true);
} else {
$(".c2Set").attr('checked', false);
}
});
$("#categoryCheck3").live("click", function () {
if ($(this).attr('checked')) {
$(".c3Set").attr('checked', true);
} else {
$(".c3Set").attr('checked', false);
}
});
/** *******************END*************************** */
$("input").live("click", function () {
var c1Count = $("#hiddenC1").val();
var c2Count = $("#hiddenC2").val();
var c3Count = $("#hiddenC3").val();
var value = 0;
value = $('input[name="c1"]:checked').length;
if (value == c1Count) {
$("#categoryCheck1").attr('checked', true);
} else {
$("#categoryCheck1").attr('checked', false);
}
value = $('input[name="c2"]:checked').length;
if (value == c2Count) {
$("#categoryCheck2").attr('checked', true);
} else {
$("#categoryCheck2").attr('checked', false);
}
value = $('input[name="c3"]:checked').length;
if (value == c3Count) {
$("#categoryCheck3").attr('checked', true);
} else {
$("#categoryCheck3").attr('checked', false);
}
value = $(".c1Set:checked").length + $(".c2Set:checked").length + $(".c3Set:checked").length;
if (value != 0) {
$("#completenessCheck").attr("disabled", true);
} else if (value == 0) {
$("#completenessCheck").attr("disabled", false);
}
});