Reputation: 11452
I am trying to call a query function call on a variable, but it is not working. Is there any way around this?
$(function() {
$variableName = '#fanpagePanelHeader';
$(variableName).click( function()
{
$("#videoAcco").click();
}
);
});
Upvotes: 0
Views: 1361
Reputation: 298106
Your variable is named $variableName
, so call the jQuery function on the variable:
$($variableName).click(...
The dollar sign is a valid character in a variable name but don't think it's jQuery-specific. It's just another character.
Upvotes: 4
Reputation: 501
I'm new to jQuery, but shouldn't it be:
var variableName = '#fanpagePanelHeader';
Upvotes: 2