jquery's append not working with svg element?

后端 未结 14 2234
北海茫月
北海茫月 2020-11-21 06:28

Assuming this:



 
 

        
14条回答
  •  青春惊慌失措
    2020-11-21 06:49

    JQuery can't append elements to (it does seem to add them in the DOM explorer, but not on the screen).

    One workaround is to append an with all of the elements that you need to the page, and then modify the attributes of the elements using .attr().

    $('body')
      .append($(''))
      .mousemove( function (e) {
          $("#c").attr({
              cx: e.pageX,
              cy: e.pageY
          });
      });
    

    http://jsfiddle.net/8FBjb/1/

提交回复
热议问题