0

i am clicking on an image and then displaying some message but after click on the ok on alert i want my image to change i am using mvc structure and html is in angular js

i tried like this

alert(response);

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

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

1.first alert

2.second click on ok the overlay window gets closed

3.but third line doesnt works for changing the image on which clicked

Pete
  • 54,116
  • 25
  • 104
  • 150

2 Answers2

1

In you posted code, i noticed only this error:

$(event.target).closest('.contDivs').find('.commentImage').addClass('display');
//----remove the dot from here---------------------------------------^
Jai
  • 72,925
  • 12
  • 73
  • 99
0

You can use:

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

where [object] is the element of which you want to change the background image.

The Codesee
  • 3,628
  • 3
  • 32
  • 71
MWT
  • 172
  • 3
  • 10
  • you can use the display properties same like that... [object].style.display="none"; – MWT Jul 08 '14 at 04:17