0

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?

MadTech
  • 1,458
  • 3
  • 13
  • 32

3 Answers3

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