Search code examples
twitter-bootstraptwitter-bootstrap-3websphere-portal

Bootstrap Collapse not working properly (Hide Not working)


I am using bootstrap collapse functionality is not working properly in our IBM web portal. It working fine on “show” functionality but not working in “Hide” functionality.

<a href="#demo" data-toggle="collapse"><span class=”icon”>Collapsible</span></a>

<div id="demo" class="collapse">
Sample Code 
</div>

I see in console window the “area-expanded” value did not change in our collapse and also did not change class name like “collapsed” and collapse in”.

How to fix it .


Solution

  • Your code works! but, It doesn't work properly without jquery.

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Title</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
      <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    </head>
    <body>
    
    <div class="container">
        <a href="#demo" data-toggle="collapse"><span class=”icon”>Collapsible</span></a>
    
        <div id="demo" class="collapse">
        Sample Code 
        </div>
    </div>
    
    </body>
    </html>