Why isn't the onclick image and toggle div functionality working with JavaScript?
I made the change from:
<input type="button" id="Showdiv1" name="Showdiv1" value="Show Div 1" onclick="showDiv('div1')" />
to:
<img src="https://developer.apple.com/homekit/images/homekit-hero.png" onclick="showDiv('div1')" />
<script>
function showDiv(id) {
$("#div1").toggle();
}
$(document).click(function(e){
if(!$(e.target).closest('#div1, input[name="Showdiv1"]').length)
{
$('#div1').hide()
}
})
</script>