Created
July 10, 2012 20:04
-
-
Save biovisualize/3085882 to your computer and use it in GitHub Desktop.
Checkbox in foreignObject
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var svg = d3.select("body").append("svg") | |
.attr("width", 100) | |
.attr("height", 100); | |
svg.append("foreignObject") | |
.attr("width", 100) | |
.attr("height", 100) | |
.append("xhtml:body") | |
.html("<form><input type=checkbox id=check /></form>") | |
.on("click", function(d, i){ | |
console.log(svg.select("#check").node().checked); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment