javascript - Changing the image source using jQuery

Pubblicato il: 04 marzo 2023
sul canale di: 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/


In questa pagina del sito puoi guardare il video online javascript - Changing the image source using jQuery della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Code Samples 04 marzo 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 454 volte e gli è piaciuto 1 spettatori. Buona visione!