我在标签中有以下代码<script>
:
$(document).ready(function(){
$("#toolbarReset").click(function() {
alert("I've been clicked! Oh, what a world!");
});
... other, unrelated functions, which all seem to work fine
});
...以及下面的一些html:
<span id="toolbarReset" style="line-height: 18px; width: 50px; height: 21px; padding: 0pt 7px 0pt 3px;">
Reset
</span>
...但是当我单击“重置”一词时,什么也没有发生。
尝试将其从使用“id”更改为“class”,并适当地更新 jQuery 代码(“#toolbarReset”变为“toobarReset”)。尝试将一些代码放入 .click 事件中以输出到 Firebug 控制台,并验证“toolbarReset”是 DOM 中的唯一 ID。