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.

Ojan Mri
  • 33
  • 1
  • 3

2 Answers2

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>
Jaydeep Pandya
  • 825
  • 1
  • 10
  • 25
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.

Bhavin Shah
  • 2,462
  • 4
  • 22
  • 35