Good time of day. Please tell me why my js code is not processed by Bitrix `s.
I need that when I press the button, I have one div get display="none" , and another display="block"
I tried through jquery, js and even through bitrix `s functions ... but still it doesn’t work .. I’m too cursed to see. Here is the js code:
var b1 = document.getElementById("b1"); var d1 = document.getElementById("d1"); var b2 = document.getElementById("b2"); var d2 = document.getElementById("d2"); b1.onclick = function(){ if(d1.style.display == 'none'){ d1.style.display = 'block'; d2.style.display = 'none'; }else{ d1.style.display = 'none'; } }; b2.onclick = function(){ if(d2.style.display == 'none'){ d2.style.display = 'block'; d1.style.display = 'none'; }else{ d2.style.display = 'none'; } }; #d1 { width: 100px; height: 100px; border: 1px solid #900; background-color:red; } #d2 { width: 100px; height: 100px; border: 1px solid #900; background-color:blue; display:none; } <button id="b1">кнопка 1</button> <button id="b2">кнопка 2</button> <br /> <br /> <br /> <br /> <div id="d1">контент</div> <div id="d2">контент</div>