Is it possible to load a specific div from a variable?
1 answer
I assume you want to do something like this:
var $item = '#myDiv';
$("#infopopup_content").load('help.html ' + $item, function() {
//blah blah
);
Make sure between the file you are trying to load and the selector. So instead of:
load('help.html' + $item...
Using:
load('help.html ' + $item...
So the concatenated string will be 'help.html #myDiv'
.
From the docs :
In jQuery 1.2, you can specify a jQuery Selector in the url. Doing this will filter the incoming HTML document, only the input elements that match the selector. The syntax is something like "url # someome> selector". The default selector "body> *" is always applied. If the url contains a space it should be escaped () d. See examples for more information.
+3
a source to share