i have two div's:
<a href="#" class="component_expand"></a>
<div class="component_wrapper">
</div>
<a href="#" class="component_expand"></a>
<div class="component_wrapper">
</div>
Jquery code:
<script type="text/javascript">
$(document).ready(function(){
$(".component_wrapper").hide();
$(".component_expand").show();
$('.component_expand').click(function(){
$(".component_wrapper").slideToggle();
});
});
</script>
I try every time I click on "component expand" one DIV open. Now open two I'd be happy with who they help me on
Use an instance of this
and .next
$('.component_expand').click(function(){
$(this).next(".component_wrapper").slideToggle();
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.