Questions tagged [toggleclass]

The toggleClass method in jQuery provides a mechanism for adding or removing a class or list of classes by name from selected elements.

The toggleClass method in jQuery provides a mechanism for adding or removing a class or list of classes by name from selected elements.

For example, if a CSS class has been applied to a div and the user wishes to remove this class from the div, the following code would accomplish this task:

theDiv.toggleClass('theClassName');

Documentation for the toggleClass method can be found in .toggleClass().

503 questions
-2
votes
4 answers

toggle class with Jquery not working

I am trying to toggle a buton class with jquery, but it's not working, here's the code: .botaoclique{ box-shadow: 0px 0px 00px #000000; } .formulario-rodape{ box-shadow: 0px 0px 00px #000000; }
-2
votes
3 answers

Why isn't jquery toggling the class of this div?

I'm trying to use Jquery to toggle the class of the div with the element #house1, however no matter what I do it just doesn't seem to want to hide itself whenever I click on it. This is the relevant html code together with the script:
Farmer
  • 7
  • 2
-2
votes
2 answers

jQuery toggleClass on specific class

I've made this jQuery code that toggles class to open and close. but when I click on the Dashboard navigator it's also affecting the other classes Here is my sample code. JavaScript: $(document).ready(function(){ $('ul.nav li…
Kevin Steve Maningo
  • 254
  • 2
  • 7
  • 16
-2
votes
3 answers

Change ID of class back after .toggleClass() is changed

jq(".1st").click( function() { jq(this).next("div").slideToggle("normal"); jq(this).toggleClass(this).attr("id","standfeat2"); } ); When I click on the drop button it drops down a message, then I want it to switch back to the…
Mac
  • 15
  • 3
-3
votes
2 answers

jQuery Toggle onClick Function not working as expected

This is simple Toggle Function when I click on .myElement(height is auto) it expand my insider div and on 2nd click it is collapse. so my problem is wherever I click on the .myElement it is collapsed I want it to collapse only while I click on…
-3
votes
2 answers

hover on one image to fade swap a different image or the div containing the image's background image?

I have a div containing 4 images in a row and a div the length of all 4 on the next row. What I want to do is apply the hover and toggleclass functions so that when you hover over each of the 4 top row images the div below's background image…
-4
votes
3 answers

Active & Inactive class add & remove

I need to add & remove class on click of anchor tag. Above div has two anchor tags & "Active" & "Inactive" one has a class 'active'. my…
MAR
  • 385
  • 3
  • 6
  • 14
-5
votes
3 answers

How to add and remove classes in jq?

Hello please solve my problem.. searching for hours but no proper and working solution found so finally I decided to post it here. Here is HTML
user3991213
1 2 3
33
34