Can I run Javascript when a user clicks a map pin?

You are here : Home / Can I run Javascript when a user clicks a map pin?

We want to be able to show different custom post type fields in the map pin popups depending on those custom fields. For example if a field is empty, I wouldn’t want to output anything. But on the other hand, if a field = “somestring” I may want to output additional data into the bubble.

The problem is that with the map settings I can only have one template that applies to every single pin bubble. What I need to do is change the template a little depending on custom field information.

I can change the data using Javascript but there doesn’t seem to be any way to attach code to the bubbles, or detect when a user clicks a bubble so I can change the text in it.

Is there any way for me to adjust the content of the pin bubble popup when a user clicks on a pin?

Here is a simple example. In my popup (infowindow) template I have this:

Send Message


It might be the case that the email field is empty, in which case I don’t want the entire block or button to show at all. How can I do this? I need to be able to “know” the field is empty and change the template output accordingly.

Thanks!

Public
Hello,
We're working on this problem in our new version meanwhile if you can give us login at support@flippercode.com, we can fix it at your end so empty tags will be removed automatically.
Thanks
#1

Please login or Register to Submit Answer

Customize Product according to your requirements?

We will be glad to discuss any of your needs related to our wordpress plugins . if any of functionality you'd like to see in products, you can reach us by via email hello@flippercode.com.