Example
Test
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.showHide {
display: none;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script>
$(document).ready(function(){
$('#event').on('click', function() {
// Using toggle to switch between hidden/shown
$('.showHide').toggle(500);
});
});
</script>
</head>
<body>
<button id="event" class="show" type="button">Show Text</button>
<div class="showHide">
Test
</div>
</body>
</html>
Most Helpful This Week
How can I redirect the user from one page to another using jQuery or pure JavaScript?
ES6 method of declaration multiple variables in one line
jQuery simple form with name and email validations
How to scroll page to 1000px from top on page load using jQuery?
Image Rollover Using onMouseOver and onMouseOut
JavaScript HTML5 Validation for name and email field