Skip to content
Advertisement

how can change the image card in bootstrap?

I just need help how can I get different image for this. I keep getting the same copied image I want the id 1 to have different image. thank you I want to present this as my defense in class.

JavaScript

Advertisement

Answer

It’s because your img src is hard coded to pet3.gif. You probably want to assign a variable name to each image you want with each id.

For eg.

  1. Image for id 1: pet_1.gif
  2. Image for id 2: pet_2.gif
  3. Image for id 3: pet_3.gif…

You get the idea. And then you can have the id inserted in the src the way you’ve done it everywhere else.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement