JQuery offers capability to hide and show, this can be implemented using hide() and show() methods.
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>implementing hide and show using JQuery </title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#btnhide").click(function () {
$("#divcontent").hide();
});
$("#btnShow").click(function () {
$("#divcontent").show();
});
});
</script>
</head>
<body>
<div id="divcontent" style="border: 1px solid gray; width: 350px; height: 200px; background-color: #E91E63;">This is visible.</div>
<input value="hide the content" type="button" id="btnhide" />
<input value="show the content" type="button" id="btnShow" />
</body>
</html>
Output:
Post your comments / questions
Recent Article
- ImportError: cannot import name 'url' from 'django.conf.urls' - Django Error
- How to Enable Virtualization in BIOS Security Settings in Intel Processors For Android Studio?
- Dependency 'androidx.activity:activity:1.8.0' requires libraries and applications that depend on it.
- AttributeError: 'NoneType' object has no attribute 'get_text' - Python
- ModuleNotFoundError: No module named 'openpyxl' - Python
- How to get thumbnail from vimeo video URL in Python?
- Remove all special characters, punctuation except spaces from string - Python
- OSError: cannot write mode RGBA as JPEG- Python
Related Article