在提醒后改变图像

问题描述 投票:0回答:2

我点击一个图像,然后显示一些消息,但点击警报上的确定后我希望我的图像改变我使用mvc结构和html是在角js

我试过这样的

alert(response);

$('.Opaque_commentWindow_add').addClass('hide');

$(event.target).closest('.contDivs').find('.commentImage').addClass('.display');

1.第一次警报

2.第二次点击确定覆盖窗口关闭

3.但第三行不适用于更改单击的图像

jquery html
2个回答
1
投票

在你发布的代码中,我注意到只有这个错误:

$(event.target).closest('.contDivs').find('.commentImage').addClass('display');
//----remove the dot from here---------------------------------------^

0
投票

您可以使用:

[object].style.backgroundImage="url('URL')" 

其中[object]是您要更改背景图像的元素。

© www.soinside.com 2019 - 2024. All rights reserved.