Method 1
You can use the selector :last-of-type to get the last element
Method 2
Use selectAll and get the last element in array.
You can use the selector :last-of-type to get the last element
var lastElement = parentObject.selectAll("rect:last-of-type");
Method 2
Use selectAll and get the last element in array.
var lastElement = parentObject.selectAll("rect");
lastElement = lastElement[lastElement.length - 1]; // this will have the last element
No comments:
Post a Comment