I'm trying to understand where to add code to delay the toggle of my div by 0.5 seconds. I am a beginner with JavaScript/jQuery.
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
//it is tied to this if it can help
<a onclick="toggle_visibility('section1_1_content');toggle_visibility('note1_1');"> <div id="help_tiem_section1_1" onclick="chngimg1()" onmouseover="this.style.cursor='pointer'">
<p1>TEST</p1><img src="down.png" height="10px" width="15px" id="imgplus1"/>
</div></a>
This works. However, I'd like to change it so that when it changes back to display none it does not delay.