Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

81
Vistas
Image not Updating using DOM manipulation

I am trying to toggle between 2 images based on a condition. I am thinking to change the src of img tag. I am able to change the src but on the webpage the image is not getting updated.

can someone point out where or what should be used or updated.

Here is my JS code ->

success: function(data){
        if(data.status == 200){
          if(data.message == "Liked"){
            document.getElementById("like_image_state_change").src="{% static 'FrontEnd1/Static_Images/CovrPage_Like_R.png' %}";

          } 
          else if(data.message == 'Like Removed'){
            document.getElementById("like_image_state_change").src="{% static 'FrontEnd1/Static_Images/CovrPage_Like_W.png' %}";
            console.log(document.getElementById("like_image_state_change"));
          }
        }
        else{
          console.log('wrong');
        }
      }
    });

Here when I console the document.getElementById in 'like Removed' I could see the updated src for the Image but the Image is still the same on the webpage.

PS -> The backend I am using is DJango. (if it matters)

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda