I have a pop up window.On click of a next button in a pop up window,the contents of current div
must be replaced with another div
contents.I want to repeat this action repeatedly on click of same next button with another divs
. How to achieve this?
Asked
Active
Viewed 673 times
0

MadTech
- 1,458
- 3
- 13
- 32
-
1Did you try anything yet? – Dhaval Marthak Apr 22 '13 at 09:08
-
duplicate of http://stackoverflow.com/questions/7139208/change-content-of-div-jquery – Harsh Baid Apr 22 '13 at 09:15
3 Answers
0
Try something like this:
var a = $('#div1').html();
var b = $('#div2').html(a);
Of course it is using Jquery.

Piotr Stapp
- 19,392
- 11
- 68
- 116
0
You can try this
function fun()
{
document.getElementById("div1").innerHTML= document.getElementById("div2").innerHTML;
}
call this function onclick event of button.

Mahesh Patidar
- 184
- 3
- 15
0
You can use jQuery .html() method to get content from div and then add this content to destination div Checkout sample on jsFiddle http://jsfiddle.net/btPb6/
function replaceContent(source, destination){
$('#'+destination).html($('#'+source).html());
}

vijay
- 1,323
- 1
- 11
- 15