why wont my script run in html using django
My page isnt doing what i programmed the javascript to do is know the code i correct if i call expand() it works but not check()
function check(i) { if (document.getElementById(i).style.visibility == "hidden") { expand(i); } else { collapse(i); } } function expand(i) { document.getElementById(i).style.visibility = "visible"; } function collapse(i) { document.getElementById(i).style.visibility = "hidden"; }
<div id="brand" onclick="check('brand-show')"> brand </div> <div class="brand-show" id="brand-show" style="visibility: hidden">dcdv</div> <div id="brand" onclick="check('brand-show')"> brand </div> <div class="brand-show" id="brand-show" style="visibility: hidden">dcdv</div>
Please help i cant get the onlick to work in django for some reason.
I don’t see any issues with the Javascript at all. This code snippet hides/shows when you click the "brand"
function check(i){ if (document.getElementById(i).style.visibility == "hidden"){ expand(i); } else{ collapse(i); } } function expand(i){ document.getElementById(i).style.visibility = "visible"; } function collapse(i){ document.getElementById(i).style.visibility = "hidden"; }
<HTML> <div id = "brand" onclick="check('brand-show')"> brand </div> <div class="brand-show" id = "brand-show" style="visibility: hidden" >dcdv </div> </HTML>