如何通过jquery更改html图像src

时间:2010-10-11 06:17:28

标签: jquery

view.aspx

<img src ="~/UserControls/Vote/Images/Arrow Up.png" id = "voteupoff" 
            runat = "server" alt ="vote up" 
    class="voteupImage" style="height: 45px; width: 45px"/>

我想改变它src~ / UserControls / Vote / Images / aftervoteupArrowUp.png点击图片时我的意思

view.js

    $('img.voteupImage').live('click', function() {

 $('img.voteupImage').attr('src', aftervoteUp);
     }
but it's not working..

1 个答案:

答案 0 :(得分:5)

$('img.voteupImage').live('click', function() {
    $(this).attr('src', aftervoteUp);
});