Introduction
In this post we will how we
can understand the JQuery basics and will walkthrough with code.
Scenario
In many cases, we will have
simple scenario like we need to show/hide or toggle the functionalities.
Consider we have simple content user can like and unlike.
Code
We simple page that user can
like and unlike, the text in the content and button values will change.
Let's see how we can do the
same thing in JQuery:
Here we have used the Jquery
toggle event option, “it binds two or more handlers to the matched elements, to
be executed on alternate clicks”.
http://api.jquery.com/toggle-event/
There is another
functionality we do with the toggle, “Display or hide the matched elements”.
As a result we will see the
tick image toggle (Show/Hide) while click the like button.
Summary
Here we will recap the
JQuery “toggle” functionality.