D3js Data Binding Enter Then Select An Element To Listen To
I would like to select elements from DOM and listen to mouse event when hover them. I'm using this library ( example on link ) let trainSelect = svg.selectAll('.train-w-dir').data
Solution 1:
The problem stems from your IDs starting with a number. This makes it harder to locator with a CSS selector or when using querySelector
You would need to escape each character likes this:
document.querySelector("#\\31\\32\\33\\35\\39\\36")
Which is really ugly and not very usable. I would recommend appending a letter to the start of your IDs. Then you can find the elements normally without the need for escaping.
Post a Comment for "D3js Data Binding Enter Then Select An Element To Listen To"