Solved

toggle function in jQuery 1.9

Posted on 2013-05-25
2
605 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
2 Comments
 
LVL 15

Accepted Solution

by:
Jagadishwor Dulal earned 500 total points
Comment Utility
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
Comment Utility
The answer was quite obvious yet i thought there is a better resolution. Thank you for your comment :-)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now