Hi, I am working on this piece of code for a shopping cart.
$('.addtoCart').click(function() { //get button id var cartID = $(this).attr("id"); //get check box id var checkBoxID = $('input.cartLevelChecked:checked').attr("id"); //get parent id var levelListID = $(this).closest('li').attr("id"); if(('#'+cartID && '#'+checkBoxID).parent('#'+levelListID)){ $(".selectPlan").show(); } //alert(/*cartID + checkBoxID +*/ levelListID); });
Basically I check if the checkbox that was set by the user is checked and the button they clicked on belongs to the same parent element and then shows the div
Any help would be greatly appreciated. thanks
source share