Solved

toggle function in jQuery 1.9

Posted on 2013-05-25
2
626 Views
Last Modified: 2013-06-18
Hello Experts,

I understand that the toggle function is no longer used in jQuery 1.9.
I am trying to understand/search for the alternative function in 1.9 and i could not understand if there is a replacement function or do we have to work around it and make something that works.

For example, instead, i add a class once the button is clicked and then i check if the button has the "clicked" class ... if the button has not that class then for me its where i insert the toggle animation.

I just want to make sure that there is no alternative function to toggle before i use this method.

Thank you!
0
Comment
Question by:Refael
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
Jagadishwor Dulal earned 500 total points
ID: 39197174
There is hasClass and addClass for the alternative of toggle. You can check them. Like your condition when you click a button you will add a class there. And if you want to to check if the class is already exist that will help by hasClass.
0
 

Author Closing Comment

by:Refael
ID: 39256923
The answer was quite obvious yet i thought there is a better resolution. Thank you for your comment :-)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question