Click event for SVG rectangle

前端 未结 2 689
夕颜
夕颜 2020-12-15 06:50

I\'m using SVG together with jQuery in my Mvc Application. I draw a series of rectangles on my page and what I would like to do is attach a click or mouseover event for each

相关标签:
2条回答
  • 2020-12-15 07:33

    Try this:

    $('rect#Y6').click( function(){
      alert('hello');
    });
    
    0 讨论(0)
  • 2020-12-15 07:40

    Your code to add the click handler needs to be part of the onLoad function - with that change it works for me.

    0 讨论(0)
提交回复
热议问题