Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

158
Visualizações
The image is loading correctly, but it fails to change when using javascript function
<img id="myImg" src="https://drive.google.com/uc?export=view&amp;id=1gsRqRNoKabIkK9z1NhioUhpFOgIKww5Q" width="107" height="98">

<button onclick="change_image()">Change Image</button>
<script>
function change_image() {
  document.getElementById("myImg").src = "https://drive.google.com/uc?export=view&amp;id=1gsRqRNoKabIkK9z1NhioUhpFOgIKww5Q";
}
</script>

Image from the same link is loading properly. But it fails to change when using a js function

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

&amp; is how you represent a & character in HTML.

It isn't how you represent one in JavaScript (not even JS in a <script> element in an HTML document as <script> elements are defined so that normal HTML parsing rules (where & would switch to the character reference state) are suspended).

The URL is getting a 400 error.

In the JS use only & without the amp;.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda