JavaScript Replacing src on image with javascript replacing image in illustrator,replacing image in indesign,replacing image

I'm trying to replace the src of an image and I currently have this:

if(('product-img img').src = "/webimages/blank.gif") {
   $(".product-img img").attr("src","/images/blank.gif");
}

It is working but it's happening to all the images on the page. I only want it to happen if the image src = /webimages/blank.gif. I've also tried $(this).attr("src","/images/blank.gif"); anyone know what I'm missing? Thanks

Answer:1

You are missging =, change = to ==, the code should as follow:

if($('.product-img img').src == "/webimages/blank.gif") {
   $(".product-img img").attr("src","/images/blank.gif");
}
Answer:2

How would i write a function that takes one argument that is a sentence and returns a new sentence where all words are reversed but kept in the same order as the original sentence? Test Case: ...

How would i write a function that takes one argument that is a sentence and returns a new sentence where all words are reversed but kept in the same order as the original sentence? Test Case: ...

im having issues trying to fill a single 10 row textarea with data using ng-repeat instead it creates a new textarea for every data entry. how can i just insert into one? and i would like to make the ...

im having issues trying to fill a single 10 row textarea with data using ng-repeat instead it creates a new textarea for every data entry. how can i just insert into one? and i would like to make the ...

  1. fill textarea with javascript
  2. fill textarea with jquery
  3. fill textarea with php
  4. fill textarea with text
  5. fill textarea with json
  6. fill textarea with value
  7. fill textarea with html
  8. fill textarea with js
  9. fill textarea with content
  10. fill textarea with javascript jquery
  11. fill textarea from database
  12. fill textarea in div
  13. javascript fill textarea with text
  14. html fill textarea with text
  15. java fill textarea with arraylist
  16. jquery fill textarea with text

I have the following HEAD tag <head> <title>Test</title> <link id="css1" href="demo.css" rel="stylesheet" type="text/css"> </head> What I want to be able to in ...

I have the following HEAD tag <head> <title>Test</title> <link id="css1" href="demo.css" rel="stylesheet" type="text/css"> </head> What I want to be able to in ...

I'm learning how to use React JS with my Rails app. Disclaimer: This is the first time I am messing around with JS! I'm following a talk by Michael Chan at Rails Conf. Everything works beautifully ...

I'm learning how to use React JS with my Rails app. Disclaimer: This is the first time I am messing around with JS! I'm following a talk by Michael Chan at Rails Conf. Everything works beautifully ...

  1. react with rails 6
  2. react with rails api
  3. react with rails tutorial
  4. react with rails user authentication
  5. react with rails
  6. react with rails 5
  7. react with rails 5.2
  8. react-rails with redux
  9. react-rails with webpacker
  10. react-rails with browserify
  11. using react with rails
  12. react js with rails
  13. react native with rails
  14. integrate react with rails
  15. react router with rails
  16. react app with rails api
  17. react native with rails backend
  18. react js with rails tutorial
  19. react app with rails backend
  20. react js with rails api