In this tutorial, I talked about a two jQuery method – switchClass() and toggleClass(). As their name suggest its related to classes, and they both are used for changing or replacing the class from an element.
When did it use?
You can use them to show the change of state of the element according to the condition, toggling classes within the elements or may be in some other cases.
For example – You have an Education website where students are assigned to courses. When student reading lessons there is an option for setting Lesson state to read or Unread. For showing the change of state you have created two classes one for unread and another for read which you want to use according to the state of a lesson.
In this kind of case you can either use removeClass() and addClass() for removing one class and add another class to an element or do it using a single method (switchClass or toggleClass).
Within tutorial, I am creating a small example for that where I use switchClass() method and various other examples to explain both methods.
Drag and drop is a simple way to allow the users to upload their files by dropping to the container. Nowadays most websites allow uploading using both drag and drop and the file browse e.g. PushBullet, Facebook, SlideShare, etc.
I am using AJAX to save the file to the server which triggers when the file dropped on the target container.
In this tutorial, I show how you can implement the similar type of feature in your project and which show thumbnail when the file successfully uploaded.
Like unlike functionality used in many websites to know the user response on their content or article.
In this tutorial, I will add like and unlike buttons within the content and handle with jQuery and PHP.
In the demonstration, I will show the list of posts within this posts they have like and unlike button. It also has a label which shows how many like and unlike get by a post. Whenever user clicked on a button the value of label gets changed.