Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 896
Alister Petterson Avatar asked Apr 10 '26 16:04

Alister Petterson


1 Answers

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

Check it out here: jQuery SVG Integration

like image 184
Jatin Bansal Avatar answered Apr 12 '26 06:04

Jatin Bansal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!