JSFiddle - React, Tailwind, and code Playground
HTML
<form name="checkbox">
<p><input type="checkbox" name="a" value="Покупка">Покупка</p>
<p><input type="checkbox" name="a" value="Аренда"> Аренда</p>
</form>
<div id="resultBox">
<div id="Покупка">Блок с покупкой</div>
<div id="Аренда">Блок с арендой<div id="test">test</div></div>
</div>
CSS
#resultBox > div{
display: none;
}
JavaScript
var resultBox = document.getElementById('resultBox');
var form = document.checkbox;
form.onclick = toShow;
function toShow(e) {
event = e || window.event;
target = event.target || event.srcElement;
if(target.type == 'checkbox'){
alert(target.checked);
// alert(document.getElementById(target.value));
if(target.checked == true){
document.getElementById(target.value).style.display = 'block';
}else{
document.getElementById(target.value).style.display = 'none';
}
}
}