Jump to content

jquery, checkboxes within nested div onclick show/hide submit

uncamoe1's Photo
Posted Jan 31 2011 12:12 PM
14094 Views

I have a page that has a series of div's in a shopping-cart system. Each is a product, when checking the checkbox, if there are options available and/or an acknowledge checkbox to be acknowledged before form submit, then keep the button hidden and show a div with another checkbox in it, when that checkbox if exists is checked then show button. The show hide on each div is working properly (existing code), So I am trying to create a function to be called within that function for the onclick event.

where my issue arises is the check to see if another check box [shown in the example as(tmpId == "acknowledge")] does exist and that it is checked also before they can see the submit button, if not show the submit button. This would need to work for each product they click the first checkbox on [ie("id= "+feeSID+"_checkbox")]... $("#ocContainer") is the hidden container(with submit) to show if proper checkboxes are checked.. for each product selected.

the first part of each id is a variable generated by a sql query and passed to the function.. My Function:

var feeSID = "";
var feeVAL = "";

function countChecked(feeSID) {
    var n = $("input:checked").val();
    var tmpId = $(this).attr("name");
    if (tmpId == "acknowledge") {
        console.log("acknowledge Clicked <br />");
    } else {
        feeVAL = $(this).attr("id");
    }
    if (feeVAL == '') {
        return;
    } else {
        if ($("#" + feeSID + "_checkbox:checked")) {
            console.log("id= " + feeSID + "_checkbox");
            var pop = $("#" + feeSID + "_popup").length;
            if (pop > 0) {
                $(":checkbox").click(function () {
                    if (tmpId == "acknowledge") {
                        $("#ocContainer").show();
                    }
                });
            } else {
                $("#ocContainer").show();
            }
        }
    }
}


I hope my explanation was clear. I am getting an error of:
uncaught exception: Syntax error, unrecognized expression: #[object Object]_popup

Tags:
0 Subscribe


0 Replies