I have a div element

<div id="map" class="map"></div>

And I have a map

 var map = new ol.Map({
    layers: [map_layer],
    target: 'map',
    view: Map_1_view

I try this to set target

 $("#map").data("my_map",  map);

but it didn't work. How can I solve this?

1 Answer 1


I solve this with


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.