javascript - ajax请求后更改元素的样式(悬停)
问题描述
当我使用这个 js 代码时:
$(".superclass").mouseenter(function() {
$(this).find('p').first().attr('style','background-color:#ff0000');});
$('.superclass').mouseleave(function() {
$(this).find('p').first().attr('style','background-color:#000000');});
我提出一个ajax请求并在输出中添加结果
<div id="output"> <div class="superclass"><p>....</p></div></div>
悬停效果不再起作用。
有可能让它工作吗?
解决方案
推荐阅读
- php - Moodle 上传 scorm 错误
- python - 在 Python 中检查两个冻结集是否相等的时间复杂度
- elasticsearch - Elasticsearch 脚本:更新每个数组元素
- mongodb - MongoDB 查找查询返回太多文档
- windows - PS不是每次都创建一个新文件
- java - 使用 slf4j 的 Project Reactor 非阻塞日志记录
- reactjs - React项目-节点模块中的传播运算符意外令牌
- pycharm - 没有遇到错误,脚本返回为 PASS,但 pyautogui 不工作(使用 PyCharm 的机器人框架)
- spring-webflux - 在 webflux 中读取请求正文
- django - 如何将相关序列化程序中的嵌套查询集限制为相关模型实例的子集?