javascript - I am trying to display a div on click of a checkbox -
i need display image , info item when checkbox clicked. reason nothing happening , have been tweaking while no response whatsoever. here javascript:
<script type = "text/javascript"> function displayonchecked(var checkboxid, var id) { if(document.getelementbyid(checkboxid)) { document.getelementbyid(id).style.display = "block"; } else { document.getelementbyid(id).style.display = "none"; } } </script> in stylesheet have on display: none;
here 1 of invocations:
<input type="checkbox" name="purchaseditem" id = "item" onclick="displayonchecked('item', 'iteminfo');">
no need var keyword in arguments list of displayonchecked, have variable names alone.
if in console, should getting error: uncaught syntaxerror: unexpected token var
Comments
Post a Comment