1

How to import code another html to div html. i have 2 file html.

first.html
<div id="slider1">/import second.html/ </div> 
<div id="slider2">/import second.html/ </div> 
<div id="slider3"> /import second.html/</div>

second.html
<div id="mask">
<ul>
<li class="1"><a href="#"><img src="" alt=""/> </a></li>
<li class="2"><a href="#"><img src="" alt=""/> </a></li>
<li class="3"><a href="#"><img src="" alt=""/> </a></li>
</ul>
</div>
<div class="progress-bar"></div>

how to import second.html to first.html. i need second.html will show in div slider1 , slider2 and slider3.

3
  • 1
    your question is not clear ? do you want to load html page to a div ? Commented Dec 23, 2016 at 6:07
  • You may search for php include for server side templating and jquery templating for client side templating. Commented Dec 23, 2016 at 6:12
  • this link will help you stackoverflow.com/questions/8988855/… Commented Dec 23, 2016 at 6:14

2 Answers 2

3

Have you tried include?

<div id="slider1"><?php include("second.html"); ?></div> 
<div id="slider2"><?php include("second.html"); ?></div> 
<div id="slider3"><?php include("second.html"); ?></div>
Sign up to request clarification or add additional context in comments.

Comments

0

There is first.html file which has 3 sliders.

function(){
  $('.second_file_contents').load('second.html'); // give appropriate path to your file
}
//first.html file contents
<div id="slider_1" class="second_file_contents"></div>
<div id="slider_2" class="second_file_contents"></div>
<div id="slider_3" class="second_file_contents"></div>

Hope this helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.