If you’re just using plain HTML and Javascript, you could include jQuery and use an AJAX request to load the contend of another HTML page in your main page.
Have a look at the jQuery ‘load()’ function here:
Assuming your have the following html:
<div id="header"></div> <div id="content"></div> <div id="footer"></div>
your usage would look something like this:
$('#header').load('header.html'); $('#footer').load('footer.html');
Related Posts:
- Failed to load resource: the server responded with a status of 404 (Not Found)
- How to properly use jsPDF library
- How to fix “Cannot read property ‘addEventListener’ of null” error [duplicate]
- How do I check whether a checkbox is checked in jQuery?
- jQuery document.createElement equivalent?
- How to make a word underline in Markdown
- Pure JavaScript equivalent of jQuery’s $.ready() – how to call a function when the page/DOM is ready for it [duplicate]
- How to play audio?
- How to play audio?
- How can I scroll to an element using jQuery?
- jQuery Get Selected Option From Dropdown
- Include another HTML file in a HTML file
- How to add jQuery code into HTML Page
- (change) vs (ngModelChange) in angular
- Bootstrap Dropdown menu is not working
- jquery SlideToggle effect in upward direction?
- Export html table data to Excel using JavaScript / JQuery is not working properly in chrome browser
- Set timeout for ajax (jQuery)
- CSS height 100% percent not working
- HTML5 Local storage vs. Session storage
- Express Render not working return error: No default engine was specified and no extension was provided
- Jquery swipe left or right on mobile
- How to move an element into another element?
- Encode HTML entities in JavaScript
- Uncaught TypeError: Cannot read property ‘top’ of undefined
- How to move all HTML element children to another parent using JavaScript?
- Coin toss with JavaScript and HTML
- How to print HTML content on click of a button, but not the page?
- Play an audio file using jQuery when a button is clicked
- Bootstrap 4 Dropdown Menu not working?
- getBoundingClientRect is not a function
- document.getElementsByClassName().innerHTML always returns “undefined”
- Jquery button click() function is not working
- Make iframe automatically adjust height according to the contents without using scrollbar?
- Vue is not defined
- How do I modify the URL without reloading the page?
- Error: ENOENT: no such file or directory, stat ‘/public/main.html’ at Error (native)
- onClick to get the ID of the clicked button
- HTML text input allow only numeric input
- How to change the buttons text using javascript
- How do I use this JavaScript variable in HTML?
- How to close current tab in a browser window?
- Why is marquee deprecated and what is the best alternative?
- Refresh/reload the content in Div using jquery/ajax
- How to pass parameters using ui-sref in ui-router to controller
- How to write inside a DIV box with javascript
- What does ngf-select do and why is it needed for form validation?
- How to get height of div in px dimension
- jQuery: Uncaught Error: Syntax error, unrecognized expression
- Creating a div element in jQuery
- SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
- How to use in jQuery :not and hasClass() to get a specific element without a class
- Crop the image using JavaScript
- Adjust width and height of iframe to fit with content in it
- Force div to be topmost element of any and all webpages
- Retrieve the position (X,Y) of an HTML element
- How to display raw JSON data on a HTML page
- HTML onchange (this.value)
- Get class list for element with jQuery
- How to make an HTML back link?
- How to fix getImageData() error The canvas has been tainted by cross-origin data?
- HTML/Javascript change div content
- How do I load an HTML page in a div using JavaScript?
- How To Save Canvas As An Image With canvas.toDataURL()?
- ReactJS – .JS vs .JSX
- How to implement “select all” check box in HTML?
- How to embed a youtube playlist with a sidebar
- Why is jquery show() not working in example
- External JavaScript Not Running, does not write to document
- JavaScript button onclick not working
- JavaScript button onclick not working
- How can I use jQuery to run MySQL queries?
- Create a simple 10 second countdown
- Print a div content using Jquery
- Get the size of the screen, current web page and browser window
- How to enable a disabled checkbox dynamically?
- What’s the effect of adding ‘return false’ to a click event listener?
- Fully responsive HTML5 video
- When is a CDATA section necessary within a script tag?
- HTML anchor link – href and onclick both?
- How to create checkbox inside dropdown?
- How can I know which radio button is selected via jQuery?
- Positioning element at center of screen
- Adding Google Translate to a web site
- “Uncaught TypeError: Illegal invocation” in Chrome
- How to use aria-expanded=”true” to change a css property
- How to wrap the content of the main tinyMCE editor with extra tags
- How do developers add “Smooth Transitions” to their sites?
- Building a slide down search box in wordpress
- Can I change an external script’s HTML?
- Why is JavaScript being added to header as application/oembed?
- creating a static HTML/JS/PHP page
- Web cover page open when button clicked
- internal anchor links no longer working after upgrade
- How to run Javascript popup modal in a loop?
- Hide CSS class only in single post pages
- How to delay display of page elements until enqueued script has injected html
- Why the images on mi javascript are not found?
- Sending GravityForms to custom HTML