admin管理员组

文章数量:1335877

I have a webpage. I want to change the icon on button down (this would be enough for me to understand but I'd be glad if you'd describe a way to animate icon after button click).

I have a webpage. I want to change the icon on button down (this would be enough for me to understand but I'd be glad if you'd describe a way to animate icon after button click).

Share Improve this question edited Oct 12, 2010 at 20:55 jball 25k9 gold badges72 silver badges92 bronze badges asked Oct 12, 2010 at 20:49 RellaRella 67k112 gold badges374 silver badges642 bronze badges 1
  • Do you want to change the favicon, or something else? More detail, please. – Matt Ball Commented Oct 12, 2010 at 20:51
Add a ment  | 

2 Answers 2

Reset to default 7

If you do want to change the favicon, jball's solution will not work, because browsers don't seem to notice when an existing <link> changes. You need to remove the existing tag and insert a new one:

$(document).ready(function(){
    $('#favicon').remove();
    $('head').append('<link href="http://example./favicon.ico" id="favicon" rel="shortcut icon">');
});

NB This supposes that your original favicon link has the id favicon.

http://api.jquery./click/

check this for click event . In that demo , remove class is using. addClass function is there.

You can change image using css itself if you want.

show() hide(); functions are there to show hide divs . you can use these too

本文标签: javascriptChanging HTML page IconStack Overflow