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.
首先,你有两个具有相同optionsid 的 div——这根本行不通。
options
但一般来说,要获取页面上的最后一个 a ,您可以执行以下操作:
var lastA = $("a:last")[0];
然后在您的点击处理程序中进行比较:
if (lastA === this) { alert("hello"); }