Skip to content
Advertisement

Making flexible piece of text for a couple of objects

I have 2 objects, vehicle1 and vehicle2 objects, for vehicle1 I have a leaflet popup:

JavaScript

I’d like to do the same with vehicle2, just to swap between objects, so I want something like that:

JavaScript

But I don’t want to repeat code like this. I tried putting it into the object with ‘this’ keyword, but it didn’t work. Thanks for help!

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement