Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to make an image change on click

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #31580

    Hello all,

    I dont know javascript so I download all the dynamic content for my sites.

    On my own website I have a list of services and I got some code so that when the user clicks one of the services more information appears. I have a little plus sign beside each service and I want it to turn into a minus sign that I have as an image. How can I do this ?

    Heres a link to the page.
    http://michaeloneilldesign.com/new/services.html

    Thanks alot,
    Micky

    #61092
    jamygolden
    Member

    Have a look at this – You could probably manipulate it to get the effect you would like: https://css-tricks.com/examples/jQueryFAQ/

    #61093

    jamy_za, I already have something similar to this. Click the link I gave. I want something to make the plus image change when clicked. Note that I only have the “Websites in XHTML and HTML5” set up to do this.

    #61094
    jamygolden
    Member

    @michaeloneill the link you gave doesn’t load. I get this error: Content Encoding Error

    #61095

    jamy_za – The link should work fine now :)

    #61102
    Johnnyb
    Member

    You can use jquery and change the src attribute:


    $('#plus-symbol-button).click(function() {
    $(this).attr('src', 'images/minus-symbol.png');
    });


    Something like that should work.

    #61080

    @johnnyb I have put that code onto the page making the necessary changes… However it still wont work! :L Check out the link http://michaeloneilldesign.com/new/services.html

    Thanks

    #61082
    jacorre
    Participant

    I think you may need to include the switch within your showslidingdiv function.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.