javascript - Changing the image source using jQuery

Publicado em: 04 Março 2023
no canal de: Code Samples
454
1

#short
#javascript
#jquery
#image
My DOM looks like this:
div id="d1"
div class="c1"
a href="#"img src="img1_on.gif"/a
a href="#"img src="img2_on.gif"/a
/div
/div

When someone clicks on an image, I want the image src to change to img src="imgx_off.gif" where x represents the image number 1 or 2.
Is this possible or do I have to use CSS to change the images?
attr(): http://api.jquery.com/attr/


Nesta página do site você pode assistir ao vídeo on-line javascript - Changing the image source using jQuery duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Code Samples 04 Março 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 454 vezes e gostou 1 espectadores. Boa visualização!