score:3

Accepted answer

The quick and dirty solution would be to simply use the index of the data element to figure out which title matches which image:

d3.selectAll(".Myimages")
      .on("mouseover", function(d, i) { 
        d3.select("#PaintingDetails")
          .selectAll("li")
          .classed("selected", function(e, j) { return j == i; })
         });

Related Query