slideToggle(show and hide img) problem
I am looking for a way to switch between 2 images in a accordion.
JS:
-
$(".toggle").click(function(){
var id = $(this).attr('id');
$("#toggl"+ id).slideToggle("slow");
if ($('.close').is(":hidden")){
$(".close").show();
$(".open").hide();
} else {
$(".open").show();
$(".close").hide();
}
});
HTML:
-
<div class="box-780-head">
<h3>Box 1</h3>
<a href="#" class="toggle" id="e1">
<img src="toggle-plus.jpg" class="close" alt=""/>
<img src="toggle-min.jpg" class="open" style="display:none;" alt=""/>
</a>
<img src="delete.jpg" class="delete" alt=""/>
</div>
<div class="box-780-body" id="toggle1">toggle content</div>
As you can see this will switch all of the button on a page.
Hope some one knows to help me with this?
I dont want to give the images an #id!
greetz