首页 > 解决方案 > 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>

悬停效果不再起作用。

有可能让它工作吗?

标签: javascriptcssajaxhover

解决方案


推荐阅读