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();
}
);
});
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.
我是jQuery的新手,但不应该是:
var variableName = '#fanpagePanelHeader';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.