为什么在块/无之间切换显示但 jQuery 显示/隐藏不起作用?
Javascript:
<div style="width: 100px; height: 100px; background-color: red;"
onmouseover="document.getElementById('div1').style.display = 'block';"
onmouseout="document.getElementById('div1').style.display = 'none';">
<div id="div1" style="display: none;">Text</div>
</div>
jQuery:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<div style="width: 100px; height: 100px; background-color: red;"
onmouseover="$('#div1').show();" onmouseout="$('#div1').hide();">
<div id="div1" style="display: none;">Text</div>
</div>