Toggleing between image

Posted by Binaryrespawn on Stack Overflow See other posts from Stack Overflow or by Binaryrespawn
Published on 2010-03-17T17:08:49Z Indexed on 2010/03/17 17:21 UTC
Read the original article Hit count: 133

Filed under:
|

Hi all, I have two images with which I am using in an anchor tag. I am using jquery toggle on the click event of the anchor tag to swap between images.

    $(document).ready(function(){
        $('#registrationForm').hide();
        $('#callform').append("<a id='formlink'>IMAGE 1</a>");
        $("#formlink").click(function(){
            $('#registrationForm').toggle(function(){
                $('#formlink').empty().append(IMAGE 2);
            });
        });
    });

This works fine the first time around, however i want to toggle between the two images whenever the other is clicked. Any ideas ?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery