---
title: "Jquery during slideToggle() class change event"  
description: "Jquery during slideToggle() class change event"  
author: "Mark Devid"  
published: 2013-05-11  
updated: 2013-05-11  
canonical: https://www.mindstick.com/forum/866/jquery-during-slidetoggle-class-change-event  
category: "jquery"  
tags: ["jquery"]  
reading_time: 1 minute  

---

# Jquery during slideToggle() class change event

Hi [Expert](https://www.mindstick.com/articles/13120/an-expert-financial-advice-will-improve-your-finances)!\
Hi there I would like to use slideToggle for a [drop down](https://www.mindstick.com/forum/263/drop-down-list-problem) the matter I struck ed there was [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to [toggle](https://www.mindstick.com/forum/12682/jquery-toggle-if-statement) swap a anchor element's [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) in the [parent](https://www.mindstick.com/blog/154/how-to-find-parent-of-control-in-wpf) div while \
Slidedown .foo class and while slideup .eee class should apply and a likely demo for this [question](https://www.mindstick.com/blog/23175/how-to-solve-neet-question-paper-in-less-time) is here\
$(".select_type").click([function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server)(){ var id=$(this).attr('id'); $("#"+id+"_drop").slideToggle(function(){ if($(this).is(':visible')){ $("#"+id+" a").addClass("foo"); } }) }) \
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)! \

## Replies

### Reply by AVADHESH PATEL

Hi Mark!\
Try as following. I hope it is helpful for you\

```
$(".select_type").click(function () {    var id = $(this).attr('id');    $("#" + id + "_drop").slideToggle(function () {       $("#" + id + " a").attr({            'class': function (_, oldVal) {                return oldVal === "up_arr" ? "down_arr" : "up_arr"; //Change the class here, based on prev value.            }        });    })});
```

\


---

Original Source: https://www.mindstick.com/forum/866/jquery-during-slidetoggle-class-change-event

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
