I'm trying to change the style of a parent element when its child input is checked.
<div> <!--- this is the parent element --->
<input type="radio" data-dynamic-update="1" name="virtuemart_paymentmethod_id" id="payment_id_3" value="3" checked="checked">
</div>
After searching online, I came across this solution:
var x = document.getElementById("payment_id_3");
x.addEventListener("click", function(){
$(x).parent().css({"background-color": "green", "border": "1px solid green"});
});
However, it doesn't seem to work. Can anyone help me fix this issue?