Jquery .load() Function Doesn’t Work Because File Loaded Contains Small Js
Two html files are being included into another html file, following advice from this post: (Include another HTML file in a HTML file). A JavaScript is being used to achieve that, b
Solution 1:
The other page will be inserted after the script completes and the document is loaded, so the document.write
will replace the current page.
Don't use document.write
- use DOM methods to select and insert text instead, for example:
<pid="rights"></p><script>
document.querySelector('#rights').innerHTML = `Copyright © ${new Date().getFullYear()}
All rights reserved | This template is made with <iclass="fa fa-heart-o"aria-hidden="true"></i> by <ahref="https://colorlib.com"target="_blank">Colorlib</a>`;
</script>
(if all pages which include this subpage also use jQuery, you can use it instead of document.querySelector
)
Post a Comment for "Jquery .load() Function Doesn’t Work Because File Loaded Contains Small Js"