javascript - Changing the image source using jQuery

Publicado el: 04 marzo 2023
en el 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/


En esta página del sitio puede ver el video en línea javascript - Changing the image source using jQuery de Duración hora minuto segunda en buena calidad , que subió el usuario Code Samples 04 marzo 2023, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 454 veces y le gustó 1 a los espectadores. Disfruta viendo!