2

I'm using this map plugin.

When I click on each country, I want to change the text in a div called #content, which is invisible by default.

I planned to make it by using a different div called #apDiv3.

Content after first click should stay visible until you click another country.

I'm using this code but nothing happens:

$(function () {
    $('#example-map-1').vectorMap({
        backgroundColor: ('#1d1e21'),
        hoverOpacity: 0.7,
        hoverColor: ('#4f1d1e'),
        onRegionClick: function (event, code) {
            if(code === 'ca') {
                event(function () {
                    $("#content").replaceWith($("#apDiv3"))
                });
            }
        });
    });
});

What am I doing wrong, and is there a better way to do this?

fglez
  • 8,422
  • 4
  • 47
  • 78

1 Answers1

2
    onRegionClick: function (event, code) {
        if(code === 'ca') {
            $("#content").replaceWith($("#apDiv3"))
        }
    });

Not entirely sure what you were going for with the event thing, but you don't need it.

James Montagne
  • 77,516
  • 14
  • 110
  • 130