Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>How to use data-* attribute with SVG Circle element</title>
</head>
<body>
<svg data-update>
  <circle cy="100" cx="100" r="50"></circle>
</svg>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
</body>
</html>
 
jQuery(function(){
  $(document).on("click", "[data-update]", function(){
    var circle = $(this).find("circle");
    circle.css({
      // IT SHOULD BE IN THIS LINE I THINK...
      fill: "red"
    });
  });
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers