Mile Mijatovic Mile Mijatovic - 4 months ago 7
jQuery Question

How to open a new image (same window) when click on accordion panel individual id

I have bootstrap accordion on the right side, and image on the left side of the panel. Is there possible to change image on the left when click on accordion panel individual id, by using jquery or I must use ajax in combination with jquery?

I will have 6 different pictures that need to be changed depending on individual id panel click

  1. You don't have to use AJAX.
  2. Next time, please try to do something and present your code.


$('.accordion__content').on('', function () {
  $('.so-widget-image').attr('src', $(this).attr('data-src'));
  1. Add data-src attribute to your collapsible panel divs with link to your image.

  2. I see that you have srcset attribute in your image, you have to get rid of this or change also this attribute.