views:

79

answers:

2

I would like to use jQuery's load function

I can write : $('#somediv').load('somefile.html #aSpecificDivinThatPage');

Now I would like to have a variable as the source div in the html page, how do i write that out ?

+2  A: 

You can just use normal string concatentation:

var div = '#aSpecificDivinThatPage';
$('#somediv').load('somefile.html ' + div);
cbeer
+1  A: 

You mean you want to copy the html from the source div and put it into another div?

$("#destinationDiv").html($("#sourceDiv").html());
Andreas Grech
a la ajax style !
marc-andre menard
the content of the filling for the div is in another html page... i can include it on the same page, but that not the question!
marc-andre menard