jQuery - .toggle() triggering on page load

Posted by Jean on Stack Overflow See other posts from Stack Overflow or by Jean
Published on 2010-06-18T12:16:13Z Indexed on 2010/06/18 12:23 UTC
Read the original article Hit count: 161

Filed under:

Hello,

When I click on the word Directory, the up arrow image must change to down, and vice-versa when clicked again.

In this code, when the page loads, toggle is triggered.

$('#direct').click(function(){
                                                                $('#arrow').attr('src','images/down_arrow_black.gif');
                                                                });


<div id="direct"><img src="images/up_arrow_black.gif" id="arrow" />Directory</div>

Thanks Jean

© Stack Overflow or respective owner

Related posts about jQuery