How to import an html page into another html?

Asked

Viewed 2,815 times

0

I have a home page where there is a menu that opens dialogs. Today is all in one html only, but I would like to separate, ie decouple and leave this html of dialog separate from the home page.

  • Have you thought about using iframe?

3 answers

0

If you don’t want to import js from w3schools to use the "W3-include-html" attribute that Patricia mentioned, you can do this using the <iframe> same html. Or even use a programming language to do the "include" of a separate file (php or .NET for example) which I particularly think is most recommended.

Hug!

0

Hello, it is possible to do this using Jquery, through the load function.

Example:

$(document).ready(function() {
    $('#modal').load('modal.html');
});

Hugs...

-1

You can use the W3-include-html attribute. Example taken from the site https://www.w3schools.com/howto/howto_html_include.asp:

<!DOCTYPE html>
<html>
<script src="https://www.w3schools.com/lib/w3.js"></script>

<body>

<div w3-include-html="content.html"></div> 

<script>
w3.includeHTML();
</script>

</body>
</html>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.