My scenario is like this: I'm trying to select a class from a list of classes, that starts with a number but is of type string (I checked).
list_item.on("click", function(){
var to_find = $(this).text().replace(/\s/g, "_");
console.log(typeof(to_find)); // on a certain moment this will become "00s"
sampleSVG.selectAll(".node:not(."+to_find+") circle, .line:not(."+to_find+")")
.transition()
.duration(500)
.style("fill", st_colours.node.fill)
.style("stroke", function(d){return d.type == "node" ? st_colours.node.stroke : st_colours.line.stroke});
sampleSVG.selectAll(".node."+to_find+" circle, .line."+to_find)
.transition()
.duration(1000)
.style("fill", st_colours.random(a))
.style("stroke", d3.rgb(st_colours.random(a)).darker());
});
When "var to_find" changes into "00s", I'm getting this error:
SyntaxError: An invalid or illegal string was specified
Can anybody tell me why I'm getting this error?