Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,
I am new to jquery. how can i give different image and style to my div on JQuery accordion code. i want to do when user click on Header accordion display and also header image is change to "Open". while it click header image change it shows "Close".
jQuery work fine but where and what code i write for changing image that don't know.

please help me for that. thanks in Advance.
Posted
Comments
Monjurul Habib 30-Mar-11 15:08pm    
provide sample code that you tried.

1 solution

There are actually lots of ways on how you can accomplish this by using JQuery. One of which can be the following:

1. Add the images on the header sections of your accordion. Be sure to identify them by name or classes or IDS.
2. Add a click event to the Header sections of your accordion.
2. Inside the click event, you can use the hide and show methods of jQuery to show or hide the images.

$(".header_section").click(
    function(){
        $("#closeImg").hide("Blind");
        $("#openImg").show("Blind");
    }
);


Note: The code alone doesn't work. Its aim is just to give you a headstart on what you will do. You still need to tailor it for your needs.
 
Share this answer
 
Comments
angle57 31-Mar-11 2:13am    
thanks walterhevedeich,

According to your suggestion we applied these things but only one image is get action not all other work if i click on any else header then also first image is in action. please let me know is there any ID related issue or i need to rework on this solution.

thanks.
walterhevedeich 31-Mar-11 4:03am    
Well, as I said, that code alone will not work so you need to do some modifications/enhancements. I would appreciate if you can post some of your codes and tags for me to have a better understanding on your problem.
angle57 5-Apr-11 2:56am    
Hi, Thanks for help, but as per your code i changed my code and i work fine now. thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900