鼠标悬停时显示删除按钮,删除后删除 li 或 div
在 php 代码中,一些英文单词从数据库(postgres)填充并放入 li 中。 我需要的是每个 li 应该有删除按钮,该按钮在加载期间隐藏。当鼠标悬停时,该图像应该可见。
之后,将使用ajax在数据库端执行删除操作,并且该li将被删除。(没有问题,因为我已经编码了)。
我浏览了这个 链接,但不仅仅是按钮单击事件整个 li 块被触发。我不想要这个,因为将来我会添加更多按钮,如编辑、垃圾邮件之类的。
当您将鼠标悬停在您所做的评论上时,可以看到同样的情况,并且删除图标将出现在 stackoverflow 中。
In php code some english words are populating from database (postgres) and put into li.
What I need is each li should have delete button which is hidden during load. When mouse is hover that image should be visible.
After that, delete operation will be performed on database side using ajax and that li will be removed.(no problem with it as I already coded).
I gone though this link, but instead of only button click event is fired for whole li block.I don't want this because in future I will add more button like edit,spam like that.
Same thing can be seen when you hover on comment you have made and delete icon will appear in stackoverflow.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
jQuery 将拯救你的日子。
jQuery will save your day.