js find child node img and change src
phpcn_u1582
phpcn_u1582 2017-05-18 10:50:30
0
4
564
 

$val[title]

$val[title]

$val[issue]

Now the image src is changed when the mouse stays on the img. I want to add the Onmouse attribute directly to the a link. How to find the node of this img and change the src of the img? Thank you

function change_img_product(obj,img){ $(obj).attr("src",img); } function change_imgs_product(obj,img){ $(obj).attr("src",img); }
phpcn_u1582
phpcn_u1582

reply all (4)
淡淡烟草味
$("a").on('mouseover',function () { $(this).find('img').src('') });
    左手右手慢动作

    You add a class or id to the img tag. When the mouse is on the a tag, you can find the corresponding class or id and find the img. Then switch the img src value

      给我你的怀抱
       .....  ..... 
      $('.product_hov img').on('mouseover',function () { var _src = $(this).attr('_src'); $(this).src(_src); });
        世界只因有你

        You guys, this is specifically

        $("a").hover(function(){
        // Go in
        $(this).find('img').src('')
        },function(){
        $(this).find ('img').src('')
        //come out
        });

          Latest Downloads
          More>
          Web Effects
          Website Source Code
          Website Materials
          Front End Template
          About us Disclaimer Sitemap
          php.cn:Public welfare online PHP training,Help PHP learners grow quickly!