Collapsible Pre-rendered Markup


To improve the load time of your page, you can provide a pre-rendered markup for collapsible by adding data-enhanced attribute and setting it to true.


Following example demonstrates the use of collapsible pre-rendered markup in jQuery Mobile.

<!DOCTYPE html>
      <title>Collapsible Pre-rendered markup</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "">
      <script src = ""></script>
      <script src = ""></script>

      <div data-role = "collapsible" data-enhanced = "true" class = "ui-collapsible 
         ui-collapsible-inset ui-corner-all ui-collapsible-collapsed">
         <h4 class = "ui-collapsible-heading ui-collapsible-heading-collapsed">
            <a href = "#" class = "ui-collapsible-heading-toggle ui-btn 
               ui-btn-icon-left ui-icon-plus">Heading
               <div class = "ui-collapsible-heading-status"> to expand contents click here</div>
         <div class = "ui-collapsible-content ui-collapsible-content-collapsed" 
            aria-hidden = "true">
            <p>Hi!!.. Have a nice day!!..</p>


Let's carry out the following steps to see how the above code works −

  • Save the above html code as collapsible_pre_rendered_markup.html file in your server root folder.

  • Open this HTML file as http://localhost/collapsible_pre_rendered_markup.html and the following output will be displayed.

Kickstart Your Career

Get certified by completing the course

Get Started