replilian replilian - 8 months ago 28
HTML Question

Can I import only a piece of html from an external file?

I need to create an html file that contains only content within a form tag of another html file, and nothing else. Is there any way to do this?


You can dynamically load html snippets after your main page loads using javascript. Something like this:


        <script src=""></script>
        <script src="script.js"></script>
        <div id="container"></div>


    <input value="testing" />


var formUrl = 'form.html';

$(window).on('load', function(){
  $.get(formUrl, function(res){

Here is a working plunk