As far as I understand, you want to access the setAnimation()-method of the object stored in the variable place72. Your approach was to store the variable name into a custom data attribute and use that name to access the variable.
This kind of doesn't work in JavaScript, but there are several easy solutions to your problem.
1. Use the data-place-id-attribute as a dictionary key
For this approach to work, you need a dictionary object where to store your created objects.
var dictionary = {
place72 = map.addMarker({ lng: 10, lat: 20 })
};
Having this, you can easily access your markers as follows:
var key = $(this).data('place-id');
dictionary[key].setAnimation(...);
2. Access global variables via the window object
You don't neccessarily need to create dictionary object in approach one on yourself, as all globals variables can be accessed through the window-object. So access can be achieved as simple as follows:
var key = $(this).data('place-id');
window[key].setAnimation(...);
From a code-design-point-of-view, this is not the best approach for medium-sized or even larger projects though.
3. Attach the desired object directly to the DOM
It is also possible to store your object in the DOM-node itself. As you're apparently using jQuery, you can make use of its data()-method:
$('[data-place-id="place72"]').data('place', map.addMarker(...));
Accessing the object is just as easy:
$(this).data('place').setAnimation(...);
This is by far my favourite solution. (;
data('place-id')returns a string, do you want to animate the string?data('place-id')returns:place72. At the same timeplace72is the name of a object. I want to animate the object.window[$(this).data('place-id')].setAnimation(null);?