JQuery Toggle

Here I am going to show you toggle example using jquery toggle element.

Example:

<!DOCTYPE html>
<html>
<head>
    <title>Toggle in Jquery Hide and show -Real Programmer</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <style type="text/css">
        .display-none{
            display: none;
        }
    </style>
</head>
<body>
   
<button class="toggle">Show</button>
<div id="example" class="display-none">
    Jquery tutorial Real Programmer
</div>
   
<script type="text/javascript">
   
$(".toggle").click(function(){
    $("#example").toggleClass('display-none');
});
    
</script>
   
</body>
</html>
Leave a Comment