How we can hide a block of html code on a button click using jquery?
Answer / Anup Kumar Pandey
To hide a block of HTML code on a button click using jQuery, you can use the `hide()` method. Here is an example:
```html
<button id='myButton'>Hide Element</button>
<div id='myDiv'>This is the div to be hidden</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
$('#myButton').click(function() {
$('#myDiv').hide();
});
});
</script>
| Is This Answer Correct ? | 0 Yes | 0 No |
How to call a method inside code-behind using jquery?
How to use migrate jquery plugin if possible? : jquery mobile
What are selectors in jquery? Explain
What is the goal of cdn and what are the advantages of using cdn?
Which selector has better performance id or class and why?
What is the use jQuery.data method?
Is jQuery is a replacement of JavaScript?
Explain the difference between jquery's ready and holdready?
How can we apply css in div using jquery?
Difference between prop() and attr()? : jQuery Mobile
How to disable jQuery animation?
Can we have multiple document.ready() function on the same page?