Skip to content

Instantly share code, notes, and snippets.

@Mauryashubham
Created March 8, 2017 11:28
Show Gist options
  • Save Mauryashubham/af52c12e84a076e4d8f971c1890e4c5a to your computer and use it in GitHub Desktop.
Save Mauryashubham/af52c12e84a076e4d8f971c1890e4c5a to your computer and use it in GitHub Desktop.
Hide/Show Div in html Using JavaScript
Hi all , Welcome to Maurya Tricks , Today we are going to discuss ,
How to make Hide/Show Div in html Using JavaScript
1.Make a file in notepad and save it as index.php and paste the below code.
<!DOCTYPE html>
<html>
<head>
<title>Simple Function to hide and show using javascript</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$(".tbl").fadeToggle("slow");
});
});
</script>
</head>
<body>
<div style="text-align: -webkit-center;margin-top: 150px;">
<h2>HIDE/SHOW SHOW USING JAVASCRIPT</h2>
<div>
<button type="button">Click To Hide/Show </button>
</div>
<div style="margin-top: 20px;">
<form>
<input type="text" class="tbl"><br><br>
<input type="text" class="tbl">
</form>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment