0
- 当完成整个页面时,它不会运行。我不知道为什么?
- 我完成加载整个页面时我是如何做的,我想运行onload函数。
谢谢大家。Jquery点击范围不起作用
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<body>
<div>
<div><span id="exid">Hello</span></div>
</div>
</body>
<script>
window.onload = function() {
$('#exid').on('click', function(){
alert('2');
});
};
</script>
</html>
当我运行代码片段(使用蓝色按钮“运行代码片段”)时,单击“Hello”标签确实会显示警告(预期行为)。所以有什么问题? –
您是否需要加载警报(而不是点击)功能? – Anuresh