In this tutorial, we will discuss about hide/show text by clicking on button.
In this tutorial, we will discuss about hide/show text by clicking on button.In this tutorial, we will discuss about hide/show text by clicking on button. In the below example, there are two buttons : hide and show .The "hide " button is used to hide text and "show button " is used to show text. These actions are fired when "click" event on button is generated.
jqHIdeShowText . html
<!DOCTYPE html> |
Description of the Program:
The text is written inside "span" tag ; using below code ,the text hides starting from last word of the text line :
$("#hidb").click(function () {
$("span:last-child").hide("fast", function () {
$(this).prev().hide("fast", arguments.callee);
});
});
Given below code is used to show text line written inside "span" tag :
$("#showb").click(function () {
$("span").show(2000);
});
The '2000' inside ".show(2000)" method is used to determining how long the animation will run
OUTPUT
Before clicking any button :
After click "Hide" button :
After clicking "show" button :