我有几个来自附加结果的 div,div 内包含图像和单选按钮,如果我选择一个 div,我该如何更改图像
$("#baggageAirline").append('<div class="col-3 list-baggage");"><input type="radio" class="input-radio-costum" required onchange="changeBackground('+response[i].airlines_id+' value="'+response[i].airlines_id+'")" onclick="getPrice('+response[i].price_in_SGD+')" name="baggage" value="'+response[i].baggage.max_range+' '+category+'"><img src="{{asset("assets/image/baggage.png")}}" alt="" class="image-selected'+response[i].airlines_id+'" width="80px"><p class="baggage-amount">'+response[i].baggage.max_range+' '+category+'</p><p class="text-center tcc">'+response[i].currency_symbol+' '+response[i].price_in_SGD+'</p></div>');
我尝试将 ID 输入到 onchange 事件中,但 ID 未定义
function changeBackground(id){
alert(id);
}
相关分类