こんにちは、私はショッピング カート用のこのコードに取り組んでいます
$('.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);
});
基本的に、ユーザーがチェックしたチェックボックスとクリックしたボタンが同じ親に属しているかどうかを確認してから、divを表示しています
どんな助けでも大歓迎です。ありがとう