Having multiple divs with the same class poses a challenge. When a user taps on one div, a slidetoggle() function reveals two buttons - "accept" and "reject". The goal is to change the background color of that specific div to green or red based on the button clicked.
The issue arises when attempting to assign colors as all divs end up changing color simultaneously.
Is there a way to target and change the color of only the specific div?
$(document).on("pagecreate","#one1",function(){
$("div.comp2").on("tap",function(){
$("#panel").slideToggle("slow", function(){
$("#accept").on("click",function(){
$(this).closest('div').css("background-color","#22bb45");
});
});
});
});