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.
我正在开发一个应用程序,其中有 5 张图像,并且我想在 touchstart 事件开始时获取图像的 ID,因为我想将这些图像移动到某个位置。我正在使用 JavaScript。
如果您使用 jQuery,并假设您已将 touchstart 事件绑定到图像
$('img').bind('touchstart', function() { var imageId = this.id; });