Jump to content

W3.JS and using w3-include-html


pgscweb
 Share

Recommended Posts

The JavaScript has to be run from the page it included in, by using callback https://www.w3schools.com/w3js/w3js_include.asp

For example

<div w3-include-html="Footer.html"></div>
        <script>

            function dothis() {
                x = document.getElementById("test");
                if (x) {
                    alert(x.nodeName);
                }
            }

            w3IncludeHTML(dothis);
        </script>

Footer.html

<h1 id="test">Hello from footer</h1>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...