jquery - Html include another Html with onclick javascript is not working after page load -


for example, having 1st page html include header page html

page 1 javascript

<script src="//code.jquery.com/jquery-1.10.2.js"></script> <script>     $(function(){      $("#header").load("header.html");    }); </script> <div id="header"></div> 

header page

<a href="#" data-toggle="dropdown" class="dropdown-toggle">booking <span class="caret"></span></a> <ul class="dropdown-menu">     <li><a id="booking" href="#">new booking</a></li>     <li id="cancel"><a href="url">cancellation</a></li>     <li id="my_booking"><a href="url">my booking</a></li> </ul> </li> 

so problem is, in header page html having menu drop-down-list. during page loading, able click menu drop down list. once page complete loaded page 1, menu malfunctioned , not response after click.

you can use w3-include-html instead include header.html.

 <!doctype html> <html> <script src="http://www.w3schools.com/lib/w3data.js"></script>  <body>  <div w3-include-html="header.html"></div>  <script>     w3includehtml(); </script>  </body> </html>  

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -