How to hide block of HTML code on a button click using jQuery ?
In this article, we will learn how to hide a block of HTML code with a button click. We can do this by using the jQuery inbuilt hide() method. Let’s briefly learn the functionality of this method.
Example 1: In the following example, text will be hidden after 2 seconds. The selected element will be hidden immediately. This is the same as calling .css(“display”, “none”). Before hiding, the hide() method saves the value of the “display” property in jQuery’s data cache so that the “display” can be later restored to its initial value.
Example 2: In the following example, we will learn how we can hide a block of HTML code on a button click using jQuery.