Mudsaf Posted April 29, 2013 Share Posted April 29, 2013 (edited) so im wondering how i can make my script work on mouse enter function. ATM <script>$(function() {$(".infoTD_image").mouseenter(function() {$(this).attr('src', 'MY_NEW_URL');console.log("ENTER: " + $(this).attr('src'));}).mouseleave(function() {$(this).attr('src', 'MY_OLD_URL');console.log("LEAVE: " + $(this).attr('src'));});});</script><img class='infoTD_image' src='MY_OLD_URL'> So my script works and it displays the Src changes, but somehow the image wont really change. Edited April 29, 2013 by Mudsaf Link to comment Share on other sites More sharing options...
dsonesuk Posted April 29, 2013 Share Posted April 29, 2013 Works for me, in main browsers, note: typo error missing single quote though Link to comment Share on other sites More sharing options...
Mudsaf Posted April 29, 2013 Author Share Posted April 29, 2013 (edited) Well as you see at table on index page the "lue lisää" images aint changing for me. http://poverihanke.mudsaf.info/ You can easily find starting line of modified code by "Source Code" & line <!-- MODIFIED WP-DATA 25.04.2013 Mudsaf --> Edited April 29, 2013 by Mudsaf Link to comment Share on other sites More sharing options...
jeffman Posted April 29, 2013 Share Posted April 29, 2013 You are adding/changing the src attribute of a <td> element. I can watch it happen using my Inspect Element tool. Change your selector. Link to comment Share on other sites More sharing options...
dsonesuk Posted April 29, 2013 Share Posted April 29, 2013 Yep! i was testing against an img tag as your example, src not recognised for td, but 'background' is, altough it is outdated. $(this).find('img').attr('src', 'MY_NEW_URL'); Link to comment Share on other sites More sharing options...
Mudsaf Posted April 29, 2013 Author Share Posted April 29, 2013 Thanks, works like charm. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now