JSFiddle - React, Tailwind, and code Playground
by Trisox
JavaScript
$("input[name=postbusORstraat]").each(function() {
var values = 'postbus';
var parent = $(this,".postbusORstraat input").parent().parent().attr('class').replace(/postbusORstraat/ig, "").replace(/formBlock/ig, "").replace(/ /ig, "");
if(parent === "" || typeof parent === "undefined" || parent === null){
$(parent+" .adresKeuze").not("#"+values).hide();
}else{
$("."+parent+" .adresKeuze").not("#"+values).hide();
}
$("#"+values).show();
});