Alister Petterson
Alister Petterson

Reputation: 51

Cannot bind trigger click on svg path element

I cannot simmulate click on svg path element. But other actions like remove() are working.

I have this and it does not work:

$("#parentelement").on("click", "someelement", function() {
      $('g path[data-code="' + something + '"].jvectormap-region.jvectormap-element').trigger("click");
 });

not working also with ....click();

But it works with .remove() or .trigger("remove");

Any ideas or help? Thanx!

Upvotes: 3

Views: 1646

Answers (1)

Jatin Bansal
Jatin Bansal

Reputation: 873

You cannot directly bind jQuery events with SVG, but there is a library to do so.

Check it out here: jQuery SVG Integration

Upvotes: 5

Related Questions