Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,如果我在锚标记中附加到 onclick,我应该能够在 DOM 加载后在 Firebug 中看到它吗?
onclick 没有触发,我试图找出问题所在。
$("#myelementid").click(function() { alert('test'); return false; });
我也试过 .onclick(...)
http://jsfiddle.net/yUTVe/
我认为您必须深入挖掘,因为您可能在某处有开放括号。您的代码完全没问题,所以除非您动态创建该元素(因此,JQuery 不适用于它),否则其他地方肯定存在语法错误。