KineticJS selector issue
http://stackoverflow.com/questions/24616238/
by klenwell
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/kineticjs/5.0.6/kinetic.js"></script>
<div id="stage-container">
canvas goes here!
</div>
CSS
body { background-color: black; color: white; }
#stage-container { background-color: white; }
JavaScript
var stage = new Kinetic.Stage({
container: 'stage-container',
width: 200,
height: 200
});
var layer = new Kinetic.Layer();
var tri = new Kinetic.RegularPolygon({
id: (16+'')+(74+''),
x: 100,
y: 100,
sides: 3,
radius: 15,
fillRed: 17,
fillGreen: 17,
fillBlue: 17,
closed: true,
shadowColor: '#5febff',
shadowBlur: 5,
shadowOpacity: 0.18
});
stage.add(layer);
layer.add(tri);
layer.draw();
console.log(layer.find('#1674'));
console.log(layer.find('#1674')[0]);
console.log(stage.find('#1674')[0]);
console.log(layer.find('#SirNotAppearingInThisCanvas'));
console.log(layer.getChildren().length);
console.log(layer.getChildren()[0].getAttr('id'));