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 to current URL, HOST and URL attributes using JavaScript or jQuery?
Image Rollover Using onMouseOver and onMouseOut
How to check if an element or HTML tag exists using JavaScript?
JavaScript check if first string contains all characters of second string
Get largest number from each sub-arrays
jQuery show input text inside div after on click event