Does anyone know if it's possible to load a specific div from a variable like
$item = '#help_mobiel_prive';
$('#infopopup_content').load('help.html'+ $item, function() {
only that one doesn't work
Does anyone know if it's possible to load a specific div from a variable like
$item = '#help_mobiel_prive';
$('#infopopup_content').load('help.html'+ $item, function() {
only that one doesn't work
I'm guessing that what you mean to do is something like this:
var $item = '#myDiv';
$("#infopopup_content").load('help.html ' + $item, function() {
//blah blah
);
Make sure there's a space between the file you're trying to load, and the selector. So instead of:
load('help.html' + $item...
Use:
load('help.html ' + $item...
So the concatenated string would be 'help.html #myDiv'
.
From the docs:
In jQuery 1.2 you can now specify a jQuery selector in the URL. Doing so will filter the incoming HTML document, only injecting the elements that match the selector. The syntax looks something like "url #some > selector". Default selector "body>*" always applies. If the URL contains a space it should be escape()d. See the examples for more information.