javascript - Changing img src does not display image -


edit: okay, code fine. there other code supposed set other attributes somewhere else , fell prey "copy/paste forgot change id name" disease. everyone's input. sorry being bonehead.

i have situation using jquery dynamically change img src attribute when user click image. switching , forth between register , unregister button. when click on register button correctly switches unregister image. however, never switch register image if click on again. code:

function unregister() {          $('#reg').attr("src","/images/btnregister.png");                      $('#reg').attr("onclick","register()"); } function register() {         $('#reg').attr("src","/images/btnunregister.png");                       $('#reg').attr("onclick","unregister()");           }  

seems easy enough. i've verified both images spelled correctly , in /images directory. need 2 routines because once little problem solved doing many different things based on operation happening. i've verified (via handy alert() call routines being called, no image switch.

change code (missing apostrophs):

function register() {     $('#reg').attr("src","/images/btnunregister.png");                   $('#reg').attr("onclick","unregister()");           }  

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -